-
Notifications
You must be signed in to change notification settings - Fork 39
Adds OTelTraceIDRatioBasedSampler #131
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
Conversation
slashmo
left a comment
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 PR 🙏 It's a good addition to the package, thanks for also adding benchmarks 👍 I'll do a final review pass once we get the breaking change in W3C Trace Context merged. My comments so far have mostly been around formatting.
Sources/OTel/Tracing/Sampling/OTelTraceIdRatioBasedSampler.swift
Outdated
Show resolved
Hide resolved
Sources/OTel/Tracing/Sampling/OTelTraceIdRatioBasedSampler.swift
Outdated
Show resolved
Hide resolved
Tests/OTelTests/Tracing/Sampling/OTelTraceIdRatioBasedSamplerTests.swift
Outdated
Show resolved
Hide resolved
Tests/OTelTests/Tracing/Sampling/OTelTraceIdRatioBasedSamplerTests.swift
Outdated
Show resolved
Hide resolved
Sources/OTel/Tracing/Sampling/OTelTraceIdRatioBasedSampler.swift
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #131 +/- ##
==========================================
+ Coverage 99.00% 99.01% +0.01%
==========================================
Files 65 68 +3
Lines 1800 1831 +31
==========================================
+ Hits 1782 1813 +31
Misses 18 18 ☔ View full report in Codecov by Sentry. |
slashmo
left a comment
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.
LGTM, thanks for contributing this sampler and especially for your patience waiting on my review 🙏
This adds a
OTelTraceIdRatioBasedSampler(see Spec).The sampler takes the last 8 bytes of the
TraceIDand interprets them as a singleUInt64value which is then used for the sampling decision. As long as those bytes are randomly distributed, this gives a deterministic, but random sampling decision.