Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prohibit usage of enum value name strings in OTLP/JSON #2758

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 19 additions & 7 deletions specification/protocol/otlp.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,25 @@ response headers when sending binary Protobuf encoded payload.

JSON Protobuf encoded payloads use proto3 standard defined
[JSON Mapping](https://developers.google.com/protocol-buffers/docs/proto3#json)
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.
for mapping between Protobuf and JSON, with the following deviations 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 as it is defined in the standard
[Protobuf 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.
For example, the `trace_id` field in a Span can be represented like this:
{ "trace_id": "5B8EFFF798038103D269B633813FC60C", ... }

- Values of enum fields MUST be encoded as integer values. Unlike the standard
[Protobuf JSON Mapping](https://developers.google.com/protocol-buffers/docs/proto3#json),
which allows values of enum fields to be encoded as either integer values or as enum
name strings, only integer enum values are allowed in OTLP JSON Protobuf Encoding;
the enum name strings MUST NOT be used.
For example, the `kind` field with a value of SPAN_KIND_SERVER in a Span can be
represented like this:
{ "kind": 2, ... }
bogdandrutu marked this conversation as resolved.
Show resolved Hide resolved

Note that according to [Protobuf specs](
https://developers.google.com/protocol-buffers/docs/proto3#json) 64-bit integer
Expand Down