fix(opentelemetry): use oneOf for metadata additionalProperties value type#13690
Open
shreemaan-abhishek wants to merge 3 commits into
Open
fix(opentelemetry): use oneOf for metadata additionalProperties value type#13690shreemaan-abhishek wants to merge 3 commits into
shreemaan-abhishek wants to merge 3 commits into
Conversation
… type The resource and collector.request_headers metadata used an invalid additionalProperties form: resource used a bare array of schemas and request_headers used one_of, which is not a JSON Schema keyword. The validator recognizes neither, so value-type validation was a no-op and values of any type passed. Switch both to oneOf so non-scalar values are rejected.
…dditionalproperties # Conflicts: # t/plugin/opentelemetry.t
AlinsRan
approved these changes
Jul 15, 2026
nic-6443
approved these changes
Jul 17, 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
The
opentelemetryplugin'smetadata_schemadeclaredadditionalPropertiesfor two objects using forms the JSON Schema validator does not recognize, so value-type validation was silently a no-op:resource.additionalPropertiesused a bare array of schemas:{{type="boolean"}, {type="number"}, {type="string"}}.additionalPropertiesexpects a single schema object, not an array; the validator sees numeric keys instead of a keyword and ignores it.collector.request_headers.additionalPropertiesusedone_of, which is not a JSON Schema keyword (the keyword isoneOf).In both cases the constraint had no effect, so
resource/request_headersvalues of any type (objects, arrays) passed validation. At runtime only string/number/boolean values are actually consumed, so non-scalar values were silently dropped. This has been present since the plugin was introduced in #6119.This changes both to the correct
oneOfform so non-scalar values are rejected at config time.Behavior change
plugin_metadataentries whoseresourceorcollector.request_headershold a non-scalar value are now rejected on write and on load. Such values were already ignored at runtime, so no working telemetry changes; the failure mode moves from "attribute silently dropped" to "invalid metadata rejected", consistent with every other schema.Tests
Added a test asserting object/array
resourcevalues and objectrequest_headersvalues are rejected (400) while scalar values remain valid. Verified it fails on the current code and passes with the fix.