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

tracer: limit the scope of setting the priority when auto dropped #2157

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions ddtrace/tracer/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"gopkg.in/DataDog/dd-trace-go.v1/internal/hostname"
"gopkg.in/DataDog/dd-trace-go.v1/internal/log"
"gopkg.in/DataDog/dd-trace-go.v1/internal/remoteconfig"
"gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames"
"gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry"
"gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof"

Expand Down Expand Up @@ -624,7 +623,7 @@ func (t *tracer) sample(span *span) {
sampler := t.config.sampler
if !sampler.Sample(span) {
span.context.trace.drop()
span.setSamplingPriority(ext.PriorityAutoReject, samplernames.RuleRate)
span.context.trace.setSamplingPriority(ext.PriorityAutoReject, SamplingRuleSpan)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SamplingRuleSpan is the wrong type here this is the value which gets used in _dd.p.dm to mark why we dropped this (although it probably doesn't actually matter here since this trace will be dropped, it's still useful for any possible metrics calculated from this value even if the trace itself isn't ingested)

Suggested change
span.context.trace.setSamplingPriority(ext.PriorityAutoReject, SamplingRuleSpan)
span.context.trace.setSamplingPriority(ext.PriorityAutoReject, samplernames.RuleRate)

return
}
if rs, ok := sampler.(RateSampler); ok && rs.Rate() < 1 {
Expand Down
Loading