-
Notifications
You must be signed in to change notification settings - Fork 208
Fixing FixedRateSampling to work in old and new version of sampling #540
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,16 +157,21 @@ public boolean process(Telemetry telemetry) { | |
| if (samplingSupportingTelemetry.getSamplingPercentage() == null) { | ||
|
|
||
| samplingSupportingTelemetry.setSamplingPercentage(samplingPercentage); | ||
|
|
||
| if (SamplingScoreGeneratorV2.getSamplingScore(telemetry) >= samplingPercentage) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per existing code , sampling will work only when the user didn't set the sampling percentage. To fix this moved the code which samples the telemetry out of the if condition. |
||
|
|
||
| InternalLogger.INSTANCE.info("Item %s sampled out", telemetry.getClass()); | ||
| return false; | ||
| } | ||
|
|
||
|
|
||
| } else { | ||
| InternalLogger.INSTANCE.info("Item has sampling percentage already set to :" | ||
| + samplingSupportingTelemetry.getSamplingPercentage()); | ||
|
|
||
| samplingPercentage = samplingSupportingTelemetry.getSamplingPercentage(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Override the local sampling percentage with the user set sampling percentage. Else global sampling percentage will be applied even if the user has set the sampling percentage. |
||
| } | ||
|
|
||
| if (SamplingScoreGeneratorV2.getSamplingScore(telemetry) >= samplingPercentage) { | ||
|
|
||
| InternalLogger.INSTANCE.info("Item %s sampled out", telemetry.getClass()); | ||
| return false; | ||
| } | ||
|
|
||
| } else { | ||
| InternalLogger.INSTANCE.trace("Skip sampling since %s type is not sampling applicable", telemetry.getClass()); | ||
| } | ||
|
|
||
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.
telemetrySamplingScore is a dynamically generated value based on operation id. This cannot be set as Sampling percentage after sampled in since this will affect the item count value in the analytics portal. So replaced this with testedPercentage which will have the correct sampling percentage.