fix(proto): accept null AnyValue fields in OTLP JSON#3603
Open
bruno-espino wants to merge 2 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3603 +/- ##
=====================================
Coverage 83.2% 83.2%
=====================================
Files 130 130
Lines 28246 28246
=====================================
Hits 23506 23506
Misses 4740 4740 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
The integration test failure appears unrelated to this change, could a maintainer please rerun the failed job? |
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.
Changes
The ProtoJSON mapping requires parsers to accept
nullfor any field and leave that field unset. TheAnyValueprotobuf definition permits itsoneofto remain unset.The custom
AnyValuevisitor introduced in #1753 deserializes recognized fields directly into their concrete type. As a result,{"intValue":null}fails withdata did not match any variant of untagged enum StringOrIntinstead of producing an emptyAnyValue. This happens before the empty-value handling fixed in #3595, so it is a separate pre-existing case.This occurs in real exporter traffic: the Vercel AI SDK can emit
doubleValue: nullfor non-finite token attributes, and PostHog independently encountered whole-request failures inopentelemetry-protoand merged a receiver-side workaround that removes null-valuedAnyValuefields before deserialization.Deserialize each recognized field through
Option, treatingnullas unset while preserving normal validation for non-null values. Regression coverage includes everyAnyValuevariant.This was also tested through an OTLP receiver's JSON ingest path: upstream
mainrejected{"intValue":null}with theStringOrInterror; with this change it decodes as an unset value, while a fractionalintValueremains rejected.Merge requirement checklist
CHANGELOG.mdupdated