Skip to content

Commit

Permalink
Clarify that lowerCamelCase field names MUST be used for OTLP/JSON
Browse files Browse the repository at this point in the history
Resolves open-telemetry#2795

This is a breaking change for OTLP/JSON and is allowed because OTLP/JSON is not yet Stable.
  • Loading branch information
tigrannajaryan committed Oct 5, 2022
1 parent 0ff1c36 commit 72df625
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ release.

### OpenTelemetry Protocol

- Clarify that lowerCamelCase field names MUST be used for OTLP/JSON
([#2829](https:/open-telemetry/opentelemetry-specification/pull/2829))
- Add user agent to OTLP exporter specification
([#2684](https:/open-telemetry/opentelemetry-specification/pull/2684))

Expand Down
14 changes: 11 additions & 3 deletions specification/protocol/otlp.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,18 @@ for mapping between Protobuf and JSON, with the following deviations from that m
represented like this:
{ "kind": 2, ... }

- The keys of JSON objects are field names converted to lowerCamelCase. Original
field names are not valid to use a keys of 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 }`.

Note that according to [Protobuf specs](
https://developers.google.com/protocol-buffers/docs/proto3#json) 64-bit integer
numbers in JSON-encoded payloads are encoded as decimal strings, and either
numbers or strings are accepted when decoding.
https://developers.google.com/protocol-buffers/docs/proto3#json):

- 64-bit integer numbers in JSON-encoded payloads are encoded as decimal strings, and
either numbers or strings are accepted when decoding.

The client and the server MUST set "Content-Type: application/json" request and
response headers when sending JSON Protobuf encoded payload.
Expand Down

0 comments on commit 72df625

Please sign in to comment.