Skip to content

[extension/header_setter] Expose auth attributes #38441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 12, 2025
Merged

[extension/header_setter] Expose auth attributes #38441

merged 3 commits into from
Mar 12, 2025

Conversation

jenrik
Copy link
Contributor

@jenrik jenrik commented Mar 6, 2025

Description

Allow settings header values based on authentication attributes

Testing

  • Ran test suite, and added tests for the new code

Documentation

Update extension README to explain from_attribute

@atoulme
Copy link
Contributor

atoulme commented Mar 7, 2025

Please add a changelog

Allow settings header values based on authentication attributes
@jenrik jenrik requested a review from atoulme March 7, 2025 08:21
@jenrik jenrik marked this pull request as ready for review March 7, 2025 08:21
@jenrik jenrik requested a review from a team as a code owner March 7, 2025 08:21
@jenrik jenrik requested a review from VihasMakwana March 7, 2025 17:15
Copy link
Contributor

@atoulme atoulme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passes my summary review. Codeowners please review.

@atoulme
Copy link
Contributor

atoulme commented Mar 11, 2025

@VihasMakwana please review.

Copy link
Contributor

@VihasMakwana VihasMakwana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@VihasMakwana VihasMakwana added the ready to merge Code review completed; ready to merge by maintainers label Mar 12, 2025
@VihasMakwana
Copy link
Contributor

@atoulme it's good to go now.

@atoulme atoulme merged commit f24444e into open-telemetry:main Mar 12, 2025
206 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 12, 2025
@jenrik jenrik deleted the feature/headersetter-auth-attrs branch March 13, 2025 06:48
@KimMJ
Copy link

KimMJ commented Mar 26, 2025

Hi. I have question on this change. I thought it resolves #34257 but seems it is not related. Do I understand it correctly? Actually I wanted to set header from attributes so tested dev environment with 0.122.0 docker image, and it was failed. otelcol get panic and restarted

image

I added tenant id from otelcol A

      attributes:
        actions:
          - action: insert
            key: tenant_id
            value: "attribute_tenant"

and tried to set header from this in otelcol B

    headers_setter:
      headers:
        - action: insert
          key: X-Scope-OrgID
          from_attribute: tenant_id
          default_value: unknown

And it didn't work.

@jenrik
Copy link
Contributor Author

jenrik commented Mar 26, 2025

Authorization attributes and metric/trace attributes are unfortunately not the same, and are very confusingly named. I had to dig through the source code to understand it.

@dehaansa
Copy link
Contributor

dehaansa commented Apr 2, 2025

Is there a way to make this work with a batchprocessor in the pipeline? From what I see in the code for batchprocessor it only preserves metadata from the ctx Info object's Metadata map, not the Auth map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension/headerssetter ready to merge Code review completed; ready to merge by maintainers waiting-for-code-owners
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants