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

trace_id check to accepts dashes as UUID format #5086

Open
juancarlosjr97 opened this issue May 5, 2024 · 6 comments
Open

trace_id check to accepts dashes as UUID format #5086

juancarlosjr97 opened this issue May 5, 2024 · 6 comments

Comments

@juancarlosjr97
Copy link
Contributor

juancarlosjr97 commented May 5, 2024

Is your feature request related to a problem? Please describe.
Long story short: trace_id to accept UUID format.

When adding the propagation and the custom header for the trace_id, aka correlation id from Kong, it fails with an error cannot generate custom trace_id: invalid digit found in the string as the Kong plugin for correlation id creates it in a format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, see Kong Correlation ID Plugin documentation: https://docs.konghq.com/hub/kong-inc/correlation-id/

Describe the solution you'd like
The router checks for the trace_id to be a hexadecimal string https://github.com/apollographql/router/blob/dev/apollo-router/src/plugins/telemetry/mod.rs#L1850-L1856 which means do not accept dashes and it fails.

A clear and concise description of what you want to happen.

Describe alternatives you've considered

Raise an MR to accept any kind of string from trace_id.

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Closely related to #5071

@Samjin
Copy link

Samjin commented May 5, 2024

related to this too. #5056

@abernix
Copy link
Member

abernix commented May 6, 2024

Do you think this is ultimately the same as #4892? If so, it should/could be fixed by #5071? (It was recently opened).

Can you take a look?

@juancarlosjr97
Copy link
Contributor Author

Hey @abernix. Thanks for sharing. I had a quick look but from my understanding, if it is stripping the dashes, how does that provide continuity using the same trace_id on the request, or am I missing something?

@abernix
Copy link
Member

abernix commented May 6, 2024

@BrynCooke You're pretty connected to the work here - Can you advise? (Look carefully they're both different nuances of dashes in trace IDs)

@BrynCooke
Copy link
Contributor

@juancarlosjr97 Trace ID in opentelemetry is represented as a 128 bit number. This is usually represented as a hex string without dashes and is based on w3c trace id format.

The UUID that is supplied by kong is a 128 but UUID. This has dashes in but is still 128 bits and so can be coerced into the Otel 128 bit number by removing the dashes and parsing as hex.

When sending to your APM, depending on protocol it will send the trace ID in different formats, but the APM should understand this and decode them to the same value. At least that's the theory.

I haven't used kong, but the docs seem to indicate that the otel plugin allows propagation of various formats:
https://docs.konghq.com/hub/kong-inc/opentelemetry/#propagation. Is this something you have configured?

@juancarlosjr97
Copy link
Contributor Author

juancarlosjr97 commented May 7, 2024

Hey @BrynCooke, if that is the case, then brilliant! Nothing else to do here, just wait until #5071 is merged and I will report back this issue.

Regarding our kong setup, we have trace id enabled in traces. The format is something I will have to check when the MR gets in and I can test it on a live environment.

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

No branches or pull requests

4 participants