opentelemetry: render unset AnyValue in OTLP JSON#11943
Conversation
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR hardens OTLP JSON output conversion by treating null/nil message pack inputs as empty OTLP "Any" objects instead of returning NULL, adds helpers for monolithic OTLP log generation and log polling, introduces integration tests for unset value preservation and partition-by-resource behavior, and improves Kafka test server robustness against connection resets. ChangesOTLP JSON Null-Value Handling and Validation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This fixes an OTLP JSON rendering failure in the Kafka output path when a valid OTLP logs payload contains an unset
AnyValuein resource, scope, or record attributes.Kafka
format: otlp_jsonreuses the shared OTLP logs JSON renderer. The protobuf OTLP input accepts unsetAnyValuefields and stores them internally as msgpack nil, but the renderer treated nil attribute values as conversion failures while building OTLP key/value arrays. That made the Kafka output drop the chunk with:The renderer now emits unset attribute values as an empty OTLP AnyValue object (
{}), while still omitting an absent/nil log body when the whole body candidate is nil.This also adds Kafka integration coverage for:
otlp_logs_partition_by_resource: true;Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
tests/integration/scenarios/out_kafka/config/out_kafka_otlp_json_partition_by_resource_small_message_max.yamlBefore the fix, the new integration test reproduced the failure:
Result: failed waiting for Kafka output. Fluent Bit log contained:
After the fix:
Result:
3 passed.Result:
3 passed. Each focused valgrind log reportedERROR SUMMARY: 0 errors.If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit
Bug Fixes
Tests