From ae0257b4977fca4834fc8ba0a3c156a2a32f25ce Mon Sep 17 00:00:00 2001 From: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com> Date: Tue, 8 Sep 2020 19:36:21 -0400 Subject: [PATCH] Use hex encoding for trace id and span id fields in OTLP JSON encoding (#911) Resolves: https://github.com/open-telemetry/opentelemetry-specification/issues/786 See discussion and motivation for the change in the issue linked above. Co-authored-by: Sergey Kanzhelev --- CHANGELOG.md | 2 ++ specification/protocol/otlp.md | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2842756d490..2d96cd1ef85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,8 @@ Updates: ([#611](https://github.com/open-telemetry/opentelemetry-specification/pull/611)) - Version attributes no longer have a prefix such as semver: ([#873](https://github.com/open-telemetry/opentelemetry-specification/pull/873)) +- Use hex encoding for trace id and span id fields in OTLP JSON encoding: + ([#911](https://github.com/open-telemetry/opentelemetry-specification/pull/911)) - Explicitly specify the SpanContext APIs IsValid and IsRemote as required ([#914](https://github.com/open-telemetry/opentelemetry-specification/pull/914)) diff --git a/specification/protocol/otlp.md b/specification/protocol/otlp.md index dd4739be07f..5be5a40e8a7 100644 --- a/specification/protocol/otlp.md +++ b/specification/protocol/otlp.md @@ -332,8 +332,13 @@ sides. JSON-encoded Protobuf payloads use proto3 standard defined [JSON Mapping](https://developers.google.com/protocol-buffers/docs/proto3#json) -for mapping between Protobuf and JSON. `trace_id` and `span_id` is base64 -encoded, not hex. +for mapping between Protobuf and JSON, with one deviation from that mapping: the +`trace_id` and `span_id` byte arrays are represented as +[case-insensitive hex-encoded strings](https://tools.ietf.org/html/rfc4648#section-8), +they are not base64-encoded like it is defined in the standard +[JSON Mapping](https://developers.google.com/protocol-buffers/docs/proto3#json). +The hex encoding is used for `trace_id` and `span_id` fields in all OTLP +Protobuf messages, e.g. the `Span`, `Link`, `LogRecord`, etc. messages. #### Response