fix(proto): accept omitted and proto-named OTLP JSON collector fields#3602
Open
bruno-espino wants to merge 2 commits into
Open
fix(proto): accept omitted and proto-named OTLP JSON collector fields#3602bruno-espino wants to merge 2 commits into
bruno-espino wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3602 +/- ##
=====================================
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:
|
4 tasks
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 OTLP collector request schemas define their resource arrays as
repeatedfields. The ProtoJSON mapping omits empty repeated fields by default, and requires parsers to accept both the lowerCamelCase JSON name and the original proto field name. OTLP uses that mapping and says empty telemetry requests should succeed.The generated collector request types instead require the resource array and only recognize its lowerCamelCase name. For example, an empty logs request (
{}) fails withmissing field resourceLogs, while a validresource_logsfield is not recognized.Add serde defaults and proto-name aliases for the trace, log, metric, and profile request roots, and configure the generator to preserve them. Regression tests cover omitted roots and both accepted field-name forms.
This was also tested through an OTLP receiver's JSON ingest path: upstream
mainrejected{}withmissing field resourceLogs; with this change,{}decodes as an empty request and{"resource_logs":[{}]}retains its resource entry.Merge requirement checklist
CHANGELOG.mdupdated