-
Notifications
You must be signed in to change notification settings - Fork 375
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
Use incoming sample priority to decide if the span should be sampled or not #521
Conversation
0b78562
to
13c3509
Compare
4c05cdd
to
0a74c05
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.
Seems fine, just one comment regarding how the test is written. Would recommend rewriting it as RSpec, but its a non-blocker.
test/sampler_test.rb
Outdated
tracer.provider.context.sampling_priority = Datadog::Ext::Priority::USER_REJECT | ||
tracer.trace('test_reject', trace_id: 4) {} | ||
|
||
assert_equal(2, tracer.writer.spans.length) |
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.
For brevity, this is okay right now, but when this gets refactored into RSpec, we should assert each one did as expected. Otherwise this test could pass if it were doing the complete opposite that we want, because there would still be two spans.
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.
Yeah. I've just added a test te verify all spans are named 'test_keep'.
Also this would have probably been nicer to write in RSpec. I chose to keep minitest only to shorten the dev-time.
Thanks for reviewing! @delner I've added a test to verify only the spans we want are kept. Can you rereview ? 😄 |
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.
👍
If sampling_priority was set on context from incoming headers or manually by the user. That value then got ignored and overwritten by
PrioritySampler
.This PR fixes this issue.
TODO: