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 sampling headers are not sent if the trace is not sampled #4544

Closed
Geal opened this issue Jan 25, 2024 · 0 comments · Fixed by #4609
Closed

trace sampling headers are not sent if the trace is not sampled #4544

Geal opened this issue Jan 25, 2024 · 0 comments · Fixed by #4609
Assignees

Comments

@Geal
Copy link
Contributor

Geal commented Jan 25, 2024

It appears that if the router does not sample a trace (either because the client sets the headers or because there's a ratio sampling configured), then it won't set headers in subgraph requests to indicate if the trace should be sampled or not. It may be related to #3226 (comment)

Geal added a commit that referenced this issue Feb 14, 2024
Fix #4544

When a trace is not sampled (due to the filtering layer we use in the
telemetry plugin), the `OpenTelemetryLayer` is not called, and so a
`TraceId`(the opentelemetry-api one, not the router side one) is never
generated, which means that when reaching the header propagation code,
the current span context is invalid (trace id = 0 and span id = 0) and
so the propagation headers are not sent.
We want the propagation headers to still be sent when the trace is not
sampled, to let the subgraphs know that they should not sample the trace
either.

One option was to explicitely set the propagation headers, but that
depends a lot on which propagation protocol is used. The trick I use
here is generating on the fly a span context with non zero trace id and
span id, so that the headers can be generated.
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

Successfully merging a pull request may close this issue.

1 participant