-
Notifications
You must be signed in to change notification settings - Fork 421
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
ddtrace/tracer: priority sampling on by default #373
Conversation
This is to improve the behavior that users observe when collecting distributed traces. With a default to on, traces that are being sampled will have the parts produced by dd-trace-go submitted to the agent. Currently, no option is provided to disable priority sampling, but code for the original behavior has been kept. This may be reconsidered in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the help with this and for the fixes, left some comments. I was away so apologies if I missed anything.
0baaae5
to
06041ae
Compare
@@ -364,17 +368,11 @@ func (t *tracer) sample(span *span) { | |||
return | |||
} | |||
if rs, ok := sampler.(RateSampler); ok && rs.Rate() < 1 { | |||
// the span was sampled using a rate sampler which wasn't all permissive, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This lock and check is not needed since sample
is called only for new spans, where the only shared structure is the trace
in the context
which has its own locks. Having it here created a deadlock between this lock and the lock used when setting a tag in the priority sampler below.
7719770
to
598391c
Compare
e96d972
to
fbd7bf9
Compare
fbd7bf9
to
dce65e5
Compare
696d625
to
1730727
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Made some slight changes and included a fix to a regression.
This change enables priority sampling by default, as well as adds some slight performance improvements to sampling, additional tests and fixes a regression where extracted span weren't sampled.
This is to improve the behavior that users observe when collecting distributed traces.
With a default to on, traces that are being sampled will have the parts produced by dd-trace-go submitted to the agent.
Currently, no option is provided to disable priority sampling, but code for the original behavior has been kept. This may be reconsidered in the future.