fix(configuration): percent-decode keys and values in resource.attributes_list#6787
Merged
pichlermarc merged 3 commits intoJun 15, 2026
Conversation
Per the OTel resource spec, `,` and `=` in attributes_list keys and values MUST be percent-encoded, and other characters MAY be. Update mergeAttributesList in FileConfigFactory to percent-decode each key/value, and discard the entire attributes_list with a warning on any parse or decode error (matches the EnvDetector in the resources package and the spec's "on error, discard all" rule). Adds three fixtures and tests: valid percent-encoding, invalid percent-sequence (%ZZ), and unencoded `=` in value. Closes open-telemetry#6769 Assisted-by: Claude Opus 4.6
Assisted-by: Claude Opus 4.6
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6787 +/- ##
==========================================
- Coverage 94.96% 94.94% -0.02%
==========================================
Files 380 380
Lines 12897 12910 +13
Branches 2937 2939 +2
==========================================
+ Hits 12247 12258 +11
- Misses 650 652 +2
🚀 New features to boost your workflow:
|
maryliag
approved these changes
Jun 8, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Jun 12, 2026
pichlermarc
approved these changes
Jun 15, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Jun 15, 2026
trentm
added a commit
to trentm/opentelemetry-js
that referenced
this pull request
Jun 15, 2026
…AttributesConfig' test cases
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.
Which problem is this PR solving?
The OTel resource spec says that
,and=inOTEL_RESOURCE_ATTRIBUTESkeys and values MUST be percent-encoded, and other characters MAY be percent-encoded. The configuration schema forresource.attributes_listuses the same format. The current parsing inmergeAttributesListignores percent-encoding.Spec: https://opentelemetry.io/docs/specs/otel/resource/sdk/#specifying-resource-information-via-an-environment-variable
Short description of the changes
Update
mergeAttributesListinFileConfigFactory:=and require exactly two parts (an unencoded=in a value means the entry is invalid per spec)decodeURIComponentattributes_listand emit adiag.warn(matches the spec's "on error, discard all" rule, and matches the existingEnvDetectorin theopentelemetry-resourcespackage)Adds three fixtures + tests:
%2C,%3D,%C3%A9)%ZZ)=in valueType of change
How Has This Been Tested?
Closes #6769