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

Why TraceID and SpanID are defined []byte type? #500

Closed
Lempossible opened this issue Jul 19, 2023 · 4 comments
Closed

Why TraceID and SpanID are defined []byte type? #500

Lempossible opened this issue Jul 19, 2023 · 4 comments

Comments

@Lempossible
Copy link

When I'm useing json.Marshal(tradeData), the trace_id, span_id and parent_span_id in output are base64 encoded.
So I wonder why TraceID and SpanID are defined []byte type?

@tigrannajaryan
Copy link
Member

Are you asking about why the particular design choice was made in OTLP? The answer to that is that it was found to be the best fit for design goals: https://github.com/open-telemetry/opentelemetry-proto/blob/main/docs/design-goals.md

If you are asking what should be OTLP/JSON representation of trace id and span id see https://github.com/open-telemetry/opentelemetry-proto/blob/main/docs/specification.md#json-protobuf-encoding

@Lempossible
Copy link
Author

Yes. So how trace id and span id in the output in expamle are not encoded?
https://github.com/open-telemetry/opentelemetry-proto/blob/v0.20.0/examples/trace.json

@tigrannajaryan
Copy link
Member

Yes. So how trace id and span id in the output in expamle are not encoded? https://github.com/open-telemetry/opentelemetry-proto/blob/v0.20.0/examples/trace.json

Examples are correct. trace id and span id are hex encoded. See the spec: https://github.com/open-telemetry/opentelemetry-proto/blob/main/docs/specification.md#json-protobuf-encoding

@carlosalberto
Copy link
Contributor

@Lempossible Has this been clarified? I feel we can close this issue already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants