From 72df62553265da40dfb9073a63aa88a31e4c009d Mon Sep 17 00:00:00 2001 From: Tigran Najaryan Date: Fri, 23 Sep 2022 12:38:05 -0400 Subject: [PATCH] Clarify that lowerCamelCase field names MUST be used for OTLP/JSON Resolves https://github.com/open-telemetry/opentelemetry-specification/issues/2795 This is a breaking change for OTLP/JSON and is allowed because OTLP/JSON is not yet Stable. --- CHANGELOG.md | 2 ++ specification/protocol/otlp.md | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c449241dcf7..7166fe4ea3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,8 @@ release. ### OpenTelemetry Protocol +- Clarify that lowerCamelCase field names MUST be used for OTLP/JSON + ([#2829](https://github.com/open-telemetry/opentelemetry-specification/pull/2829)) - Add user agent to OTLP exporter specification ([#2684](https://github.com/open-telemetry/opentelemetry-specification/pull/2684)) diff --git a/specification/protocol/otlp.md b/specification/protocol/otlp.md index 824aadc5582..b3ed1dca942 100644 --- a/specification/protocol/otlp.md +++ b/specification/protocol/otlp.md @@ -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.