Skip to content
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

[EXPORTER] Support URL-encoded values for OTEL_EXPORTER_OTLP_HEADERS #2579

Merged
merged 8 commits into from
Mar 7, 2024

Conversation

pyohannes
Copy link
Contributor

@pyohannes pyohannes commented Mar 7, 2024

Fixes #2523

Changes

This PR adds support for URL-encoded values in OTEL_EXPORTER_OTLP_HEADERS and related headers, which is required by the specification.

The necessary url_decode function is added to ext/include/opentelemetry/ext/http/common/url_parser.h, which was renamed to ext/include/opentelemetry/ext/http/common/url_util.h to reflect the change.

For backwards compatibility, both URL-encoded and non-URL-encoded values are supported, for example:

OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic%20AAA"
OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic AAA"
  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@pyohannes pyohannes requested a review from a team March 7, 2024 10:22
Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

Thanks for the fix.

Could we not rename url_parser.h to url_util.h ?

This will break user code, if there happens to be an include to url_parser.h, even when not used.

@pyohannes
Copy link
Contributor Author

Could we not rename url_parser.h to url_util.h ?

@marcalff Got it, I reverted the renaming.

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix.

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

Thanks for the fix.

@lalitb lalitb merged commit e5c2e25 into open-telemetry:main Mar 7, 2024
47 checks passed
malkia added a commit to malkia/opentelemetry-cpp that referenced this pull request Mar 7, 2024
Support URL-encoded values for `OTEL_EXPORTER_OTLP_HEADERS` (open-telemetry#2579)
@marcalff marcalff changed the title Support URL-encoded values for OTEL_EXPORTER_OTLP_HEADERS [EXPORTER] Support URL-encoded values for OTEL_EXPORTER_OTLP_HEADERS Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

URL encoded values for OTEL_EXPORTER_OTLP_HEADERS are not exported
3 participants