-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add "sampling.priority" support to probabilistic sampler #469
Add "sampling.priority" support to probabilistic sampler #469
Conversation
processor/samplingprocessor/probabilisticsamplerprocessor/probabilisticsampler.go
Outdated
Show resolved
Hide resolved
processor/samplingprocessor/probabilisticsamplerprocessor/probabilisticsampler.go
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #469 +/- ##
==========================================
+ Coverage 75.73% 75.76% +0.03%
==========================================
Files 120 120
Lines 7347 7386 +39
==========================================
+ Hits 5564 5596 +32
- Misses 1518 1523 +5
- Partials 265 267 +2
Continue to review full report at Codecov.
|
processor/samplingprocessor/probabilisticsamplerprocessor/probabilisticsampler.go
Show resolved
Hide resolved
CC: @lmolkova @lizthegrey |
damn, you got my hopes up because I read "sampling.probability" instead of "sampling.priority" ;) will have a look tomorrow. |
@lizthegrey I think the idea is the same. At least based on description. |
It's similar, but different. the spec appears to specify ">0" or "0", but doesn't explicitly state the non-zero value is the previous sample rate, nor do we use the sample rate here to multiply by our sample rate when reporting out sampling rates, nor do we propagate our sample rate as |
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.
@lizthegrey if you have some spec/text of "sampling.probability" I can take a look to see how the collector can implement/participate on that.
Follow up to PR review comments
This only failed after rebase and `make install-tools`
bcb8506
to
4b85537
Compare
processor/samplingprocessor/probabilisticsamplerprocessor/probabilisticsampler.go
Outdated
Show resolved
Hide resolved
processor/samplingprocessor/probabilisticsamplerprocessor/probabilisticsampler.go
Show resolved
Hide resolved
processor/samplingprocessor/probabilisticsamplerprocessor/probabilisticsampler.go
Show resolved
Hide resolved
processor/samplingprocessor/probabilisticsamplerprocessor/testdata/config.yaml
Show resolved
Hide resolved
processor/samplingprocessor/probabilisticsamplerprocessor/testdata/config.yaml
Outdated
Show resolved
Hide resolved
return mustSampleSpan | ||
} | ||
return deferDecision | ||
} |
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.
Is this function worth the effort? It only saves 2 lines and adds cognitive overhead. I'm also not sure whether the Go compiler will inline the call.
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.
The compiler does inline this call, but, let me put the alternative and see what people prefer in general.
processor/samplingprocessor/probabilisticsamplerprocessor/probabilisticsampler.go
Outdated
Show resolved
Hide resolved
* remove check for "" value for string attribute * remove local function, duplication seems reasonable * improve comment about hash_seed usage
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 from semantics perspective. Want to see more on passing sampling.priority
via tracestate and left a question about setting sampling.priority by collector in case of defer decision.
sampling_percentage: 15.3 | ||
# hash_seed allows one to configure the hashing seed. This is important in |
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.
When the sampling algo works on span inside the collector - will the sampling.priority
be set on it for downstream to be able to read it?
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.
It can be configured separately on the attributesprocessor
.
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.
How will the attirbuteProcessor know the seed value and the resulting hash value calculated from the TraceID?
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.
The calculated hash is not exposed (it is a predictable algo though). If desired the seed can be shared in the configuration as an environment variable so both processors can use the same value. I think that perhaps I'm missing some context @SergeyKanzhelev on how you need this to work, if you have more info let me know.
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.
sampling.priority
is used to communicate calculated value of a hash. Typically from SDK to a dependent service (via tracestate-like propagation) and to collector for additional sampling and/or better visualization. If collector is running as a sidecar and calculates hash - it may be useful to communicate this information to collector which is actually collecting data. In case additional sampling needs to be implemented on the whole cluster for instance.
@SergeyKanzhelev created issue #476 to track support to |
Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
Adds support to OpenTracing "sampling.priority" per semantic conventions at https://github.com/opentracing/specification/blob/master/semantic_conventions.md#span-tags-table