feat(config): add shared _parse_headers helper for declarative config exporters#5021
Merged
xrmx merged 4 commits intoopen-telemetry:mainfrom Apr 1, 2026
Merged
Conversation
Extracts the header-merging logic that is duplicated across the tracer, meter, and logger provider config modules into a single shared helper in _common.py. Subsequent provider PRs will import from here instead of defining their own copy. Assisted-by: Claude Sonnet 4.6
Assisted-by: Claude Sonnet 4.6
herin049
approved these changes
Mar 29, 2026
tammy-baylis-swi
approved these changes
Mar 30, 2026
xrmx
approved these changes
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Extracts
_parse_headers— which merges an OTLP headers struct and aheaders_liststring into a single dict — into a new shared_common.pymodule.This function is identical across the tracer, meter, and logger provider config PRs (#4985, #4987, #4990). Centralising it here means those PRs can import from
_commonrather than each defining their own copy, and keeps the logic in one place to test and maintain.Note: this does not consolidate
_parse_headerswith_parse_attributes_listin_resource.py— they look similar but differ semantically: resource attributes are URL-decoded (urllib.parse.unquote), headers are not.Type of change
How Has This Been Tested?
11 unit tests added in
tests/_configuration/test_common.pycovering:=, malformed)Does This PR Require a Contrib Repo Change?
Checklist:
Assisted-by: Claude Sonnet 4.6