fix(proto): accept null AnyValue fields in OTLP JSON - #3603
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:
|
|
The integration test failure appears unrelated to this change, could a maintainer please rerun the failed job? |
|
Thank you for your contribution! This PR has been automatically marked as stale because it has not had activity in the last 14 days. This may be due to a delay in review on our side or awaiting a response from you; either is fine, and we appreciate your patience. It will be closed in 14 days if no further activity occurs. Pushing a new commit or leaving a comment will remove the stale label and keep the PR open. |
|
Closed as inactive. Thank you again for the contribution; please feel free to reopen this PR (or open a new one) if you'd like to continue the work. |
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