-
Notifications
You must be signed in to change notification settings - Fork 438
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
v2: remove sampling priority #2906
Conversation
BenchmarksBenchmark execution time: 2024-10-04 13:45:17 Comparing candidate commit 9b50388 in PR branch Found 1 performance improvements and 0 performance regressions! Performance is the same for 52 metrics, 0 unstable metrics. scenario:BenchmarkInjectW3C-24
|
ddtrace/tracer/span.go
Outdated
case ext.ManualDrop: | ||
if v == float64(samplernames.AppSec) { | ||
s.setSamplingPriorityLocked(ext.PriorityUserReject, samplernames.AppSec) |
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.
@hannahkm Shouldn't we support ext.ManualKeep
too?
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.
Do you mean as a case? In which case (no pun intended) it's on line 529 (it had existed already before)
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.
Oh, I missed it. Ok, good to go! 😁
@@ -214,7 +214,7 @@ func TestShouldDrop(t *testing.T) { | |||
} { | |||
t.Run("", func(t *testing.T) { | |||
s := newSpan("", "", "", 1, 1, 0) | |||
s.SetTag(ext.SamplingPriority, tt.prio) | |||
s.setSamplingPriority(tt.prio, samplernames.Default) |
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.
quick question, why default here?
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.
afaik, the value we pass into samplernames
doesn't make an impact for this test case, so I opted to keep the code clean (i.e. not adding if statements or extraneous parameters to the tt
structs), since we would otherwise have to check for priorities 2
or -1
to set it to Manual
.
Default
says that the priority was set without a sampler
, which I believe still holds true in this case. Maybe I'm missing some logic here?
ddtrace/tracer/span.go
Outdated
// We have it here for backward compatibility. | ||
s.setSamplingPriorityLocked(int(v), samplernames.Manual) | ||
case ext.ManualDrop: | ||
if v == float64(samplernames.AppSec) { |
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.
I am not sure we need to add this here to be honest. There is a weird use case for ManualKeep, defined by appsec rules. But they don't use the same convention for manualDrop 🤔
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.
@Julio-Guerra Any idea why this there?
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.
Did you git-blame the file? It wasn't me who wrote those lines but @Barbayar a few years ago when he worked on distributed tracing on all tracers. IIRC, it was just about the decision maker tag _dd.p.dm
.
ASM doesn't rely on those details, we're good as long as we can force-keep the traces when we have security events.
The only ASM RFC where we went into such details is the standalone ASM billing RFC and they are system-tested so regressions would be found if any.
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.
Reading the PR description, I believe it would be great to keep a lower-level API for internal usage that provides more options. But likely bonus as far as I am aware of our product needs.
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.
Yes, I spoke with @Barbayar and it seems that AppSec has a few cases where we want to keep specific traces, which is why I decided to keep the case. I'll keep the ManualKeep
case, but seems like we don't need the ManualDrop
, so I've removed it. Thanks!
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.
Not sure either about what is on about the manual drop appsec :/
Would like to hear back from @Julio-Guerra on the appsec manual drop comment before merging if you don't mind
What does this PR do?
Removes support for
ext.SamplingPriority
. Users should opt to usespan.SetTag(ext.ManualKeep, true)
for keeping spans/traces, andspan.SetTag(ext.ManualDrop, true)
for dropping spans/traces.Motivation
Re: PR #1082 ,
ext.SamplingPriority
has been deprecated.Reviewer's Checklist
Unsure? Have a question? Request a review!