open-telemetry / opentelemetry-proto

OpenTelemetry protocol (OTLP) specification and Protobuf definitions
https://opentelemetry.io/docs/specs/otlp/
Apache License 2.0
545 stars 242 forks source link

Example JSONs use wrong key name cases #565

Closed swamisriman closed 3 weeks ago

swamisriman commented 3 weeks ago

The JSON keys in the example files use camel case where as the fields are defined in .proto files in snake case. This is causing issues with JSON parsing. For reference, see issue: https://github.com/open-telemetry/opentelemetry-proto-go/issues/176

tigrannajaryan commented 3 weeks ago

The examples look correct to me. The spec says:

The keys of JSON objects are field names converted to lowerCamelCase. Original field names are not valid to use as keys for JSON objects. For example, this is a valid JSON representation of a Resource: { "attributes": {...}, "droppedAttributesCount": 123 }, and this is NOT a valid representation: { "attributes": {...}, "dropped_attributes_count": 123 }.

swamisriman commented 3 weeks ago

Yes @tigrannajaryan

The examples are fine. I was using wrong package to marshall and unmarshall jsons

Ref: https://github.com/open-telemetry/opentelemetry-proto-go/issues/176#issuecomment-2147055182

Thanks for looking into this!!