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

ddtrace/tracer: priority sampling on by default #373

Merged
merged 6 commits into from
Dec 24, 2018

Conversation

cgilmour
Copy link
Contributor

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.

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.
@palazzem palazzem added this to the 1.8.0 milestone Dec 19, 2018
@palazzem palazzem requested a review from gbbr December 19, 2018 15:56
@palazzem palazzem added the core label Dec 19, 2018
Copy link
Contributor

@gbbr gbbr left a 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.

ddtrace/tracer/option.go Outdated Show resolved Hide resolved
ddtrace/tracer/span_test.go Outdated Show resolved Hide resolved
ddtrace/tracer/span_test.go Outdated Show resolved Hide resolved
ddtrace/tracer/spancontext.go Outdated Show resolved Hide resolved
ddtrace/tracer/textmap.go Outdated Show resolved Hide resolved
ddtrace/tracer/tracer.go Outdated Show resolved Hide resolved
ddtrace/tracer/tracer.go Outdated Show resolved Hide resolved
ddtrace/tracer/tracer.go Outdated Show resolved Hide resolved
ddtrace/tracer/tracer.go Outdated Show resolved Hide resolved
@gbbr gbbr force-pushed the cgilmour/priority-sampling-default-on branch from 0baaae5 to 06041ae Compare December 24, 2018 12:33
@@ -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,
Copy link
Contributor

@gbbr gbbr Dec 24, 2018

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.

@gbbr gbbr force-pushed the cgilmour/priority-sampling-default-on branch 2 times, most recently from 7719770 to 598391c Compare December 24, 2018 12:52
@gbbr gbbr force-pushed the cgilmour/priority-sampling-default-on branch 2 times, most recently from e96d972 to fbd7bf9 Compare December 24, 2018 13:36
@gbbr gbbr force-pushed the cgilmour/priority-sampling-default-on branch from 696d625 to 1730727 Compare December 24, 2018 13:54
Copy link
Contributor

@gbbr gbbr left a 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.

@gbbr gbbr merged commit 7fb2bce into v1 Dec 24, 2018
@gbbr gbbr deleted the cgilmour/priority-sampling-default-on branch December 24, 2018 14:52
mingrammer pushed a commit to mingrammer/dd-trace-go that referenced this pull request Dec 22, 2020
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants