[DO NOT MERGE] Prototype JSON representation for attribute collections - #8768
[DO NOT MERGE] Prototype JSON representation for attribute collections#8768pellared wants to merge 4 commits into
Conversation
Pull request dashboard statusWaiting on the author · refreshed 2026-09-02 21:38 UTC Move out of draft to request review. Status above doesn't look right?
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8768 +/- ##
============================================
+ Coverage 91.29% 91.30% +0.01%
- Complexity 10498 10502 +4
============================================
Files 1006 1006
Lines 28338 28351 +13
Branches 3581 3583 +2
============================================
+ Hits 25870 25885 +15
+ Misses 1675 1672 -3
- Partials 793 794 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| + "service.name=\"unknown_service:java\", " | ||
| + "telemetry.sdk.language=\"java\", " | ||
| + "telemetry.sdk.name=\"opentelemetry\", " | ||
| + "telemetry.sdk.version=\""); |
There was a problem hiding this comment.
The tension here is that the current format is the idiomatic toString() implementation in java.
Its meant for debugging, not machine readability. Actually, not being reliably machine readable is strength here since it reduces the likelihood of someone depending on the structure of toString and crying "breaking change!" when we change it.
Prototypes open-telemetry/opentelemetry-specification#5149 in Java.
This complements the existing Go prototypes:
What this prototypes
Attributesimplementation'stoString()to encode the collection as a compact JSON object.Value.asString(), including its handling of nested arrays/maps, bytes, empty values, non-finite doubles, and JSON escaping.LoggingSpanExporterandSystemOutLogRecordExporter.For example, diagnostic output changes from:
to:
{"animal":"cat","bytes":"AQID","empty":null}Scope and merge status
This is intentionally a draft and marked DO NOT MERGE while the specification change is pending.
No public API or dependency is added. The repository documents
toString()output as unstable. The logging/stdout exporter formats also remain diagnostic and unspecified; their updated tests demonstrate that the proposed common representation works in real exporters, not that the surrounding exporter format is now guaranteed.This PR prototypes the Attribute Collection representation section. Java does not expose a standalone
Attributepair type, so this does not add public API solely to prototype the single-attribute section.AI assistance
This prototype was prepared with (a huge) assistance from OpenAI Codex. 😉