Skip to content

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

Merged
lalitb merged 8 commits intoopen-telemetry:mainfrom
pyohannes:url-decode-headers
Mar 7, 2024
Merged

[EXPORTER] Support URL-encoded values for OTEL_EXPORTER_OTLP_HEADERS#2579
lalitb merged 8 commits intoopen-telemetry:mainfrom
pyohannes:url-decode-headers

Conversation

@pyohannes
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@marcalff Got it, I reverted the renaming.

Copy link
Copy Markdown
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
Copy Markdown
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
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