-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add policy to spans in sampled traces #35180
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
I'm not keen on adding another attribute to all spans passing through the tail-sampling processor but I'd be willing to look at PR for this if this is placed behind a feature gate. |
This would be really useful for debugging new sampling configs in particular.
I don't think the risk of losing the root span is very high here since we are using the |
Just to add that we have a use case where such an attribute could be very helpful: understanding latency distributions. We combine the probabilistic policy with the latency policy and when attempting to analyze operation latency for our services, it's hard to get an accurate picture as the latency policy (as by design) biases towards slow traces. If the policy was recorded as an attribute, we'd be able to calculate latency over only the traces captured by the probabilistic policy. |
@jpkrohling I've made an attempt at resolving this issue in this PR, I'd be very grateful if you could review this at some point. |
Component(s)
processor/tailsampling
Is your feature request related to a problem? Please describe.
There is no currently no way to tell by looking at a sampled trace which policy sampled it. If we could, we'd be able to analyze traces by policy, direct traces to different pipelines by policy, and better understand the sampling behavior of this processor.
Describe the solution you'd like
I propose that we add the name of the first top-level policy that returns a positive sampling decision to each span in a trace as an span context attribute. For example, given the following policies:
And given a trace which includes a span with a 404 status code. Say the
probabilistic-policy
returned aNotSampled
decision, but thehttp-error-policy
returned aSampled
decision. A span in this trace would look like:Describe alternatives you've considered
forward
connector, set up tail-sampling on each branch with different policies, then use thetransform
processor to add an attribute for the branch a trace was sampled in: Not only does this use more resources as multiple processors have to be set up, it can also result in duplicate samples, and there isn't an easy way to dedup spans/traces in the collector.Additional context
I'd be willing to create a PR for this if maintainers agree that this is a good idea.
The text was updated successfully, but these errors were encountered: