-
Notifications
You must be signed in to change notification settings - Fork 543
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
Trace IDs with leading zeros are trimmed in the Search API response #4723
Comments
I'm not sure I see the issue here. Left padding a string with 0s doesn't feel like it adds any value? The numerical values are equivalent. |
Hi @joe-elliott, to elaborate further on the issue here:
In such cases, the search API consumer would need pad the trace ID to be able to correlate with other sources. Note: A similar issue was raised for span IDs and a fix was made to pad the span IDs to make sure returned span IDs are 16 hex characters long (relevant comment). Can we have the same approach for trace IDs as well so they are formatted uniformly according to the spec (32 hex character long)? |
We are going to leave this the way it is for now. Both leading 0s and not are equivalent and correct responses. if we add leading 0s it's possible someone will file an issue asking to remove them to match the particular needs of their client. In the case of spans we added leading 0s b/c it solved an issue with Grafana. Thanks for bringing this need to our attention, but we will leave it alone. |
@joe-elliott I am trying to understand how this is being considered a client need and not an issue of conforming to a standard/spec. The trace ID spec in the context of interoperability with non-compliant systems, states padding TraceIDs with 0s to ensure they are compliant with the standard.
The OpenTelemetry Tracing API spec (https://opentelemetry.io/docs/specs/otel/trace/api/#retrieving-the-traceid-and-spanid) also states the following:
In Tempo's case, a fully compliant trace ID is being sent to tempo, however it's not being returned in the search API to spec. From the comment on the spanID issue:
Trace IDs are 16 byte array or 32 character hex string (https://www.w3.org/TR/trace-context/#trace-id), and I am wondering why they can't be represented with the similar standards that spanIDs are treated with.
On the numerical equivalence of two values, the API is returning a string representation (not a numerical representation), so I am not sure if they can be considered equivalent.
If this does happen, they can be redirected to the trace context spec, indicating that trace IDs are 32 character hex strings. I am trying to understand how a spec can be enforced for spanIDs (because it solves an issue with grafana), and not for traceIDs. I am open to working on a PR if there is consensus. Thanks again for following up on the issue, appreciate your help. |
Describe the bug
Summary
When a trace with leading zeros in the trace ID (ex:
008efff798038103d269b633813fc703
) is ingested to Tempo, the trace ID in the search API results is trimmed to omit the leading zeros.Description
The TraceIDToHexString function is being used to generate the string representation for the trace ID and this removes the leading zeros in the trace ID. It looks like this function is being used in a few places including:
We have observed that for trace IDs with leading zeros, the search API response includes the trimmed trace IDs instead of the full trace ID (16 byte hexstring). The trace ID API succeeds with either the trimmed trace ID or the zero prefixed trace IDs.
Because of the trimming of leading zeros, it's not straightforward to correlate trace IDs with external sources as the API consumer has to left pad the trimmed IDs to make them compatible with the trace context spec.
We noticed that a similar fix was rolled out for span IDs.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Tempo should return a 16 byte hexstring trace ID in the search API response.
Environment:
Additional Context
The text was updated successfully, but these errors were encountered: