Skip to content

Commit

Permalink
Use hex encoding for trace id and span id fields in OTLP JSON encoding (
Browse files Browse the repository at this point in the history
open-telemetry#911)

Resolves: open-telemetry#786

See discussion and motivation for the change in the issue linked above.

Co-authored-by: Sergey Kanzhelev <[email protected]>
  • Loading branch information
tigrannajaryan and SergeyKanzhelev authored Sep 8, 2020
1 parent 080bc43 commit ae0257b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
9 changes: 7 additions & 2 deletions specification/protocol/otlp.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ae0257b

Please sign in to comment.