You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug of XRay Sampler Implementation in all OTel SDK Languages. This impacts Sampling Statistics reported by XRay sampler, particularly the SamplingStatisticsDocuments’s metrics of [BorrowCount, RequestCount, SampledCount], which is sent to XRay Service via the /SamplingTargets endpoint.
Example: If a single request to an Application using XRay Sampler creates 1 Server Span (makes decision Sampled=true) with 8 child Internal Spans (copies parent's Sampled value) :
Actual: XRay Sampler will produce Sampler Metrics of RequestCount=9, SampledCount=9
XRay Sampler produces Sampler metrics based on number of Spans of any kind
Expected: XRay Sampler should produce Sampler Metrics of RequestCount=1, SampledCount=1
XRay Sampler should produce Sampler metrics based on number of Traces (aka the root Span that makes the Sampling Decision)
In summary, the bug is that while Spans with a parent Span will copy their parent’s XRay Sampling Decision, they will still make additions to the XRay Sampling metric (they shouldn’t because they do not make the decision, only copy it)
How does this negatively affect OTel users of XRay Sampler?
If user observes Sampling Rules Console, a Sampling Rule’s Trend Graph will report metric numbers that are much greater than the actual number of Traces sampled.
Given the above example, the graph will incorrectly show 9 req matching the rule, with 9 sampled instead of the actual 1 req matching the rule, with 1 sampled.
Root cause should be because only subcomponents of XRay Sampler uses ParentBased logic to short-circuit the Parent's Sampling Decision, while the XRay Sampling Statistics recording logic is not skipped when a Parent's Sampling Decision is found.
Thus the fix is to wrap the entire XRay Sampler Internal Logic under a single ParentBased Sampler, which will skip recording the "extra" sampling statistics when a Parent's Sampling Decision is available.
The text was updated successfully, but these errors were encountered:
…arentBased logic (#269)
### Issue #, if available:
This PR fixesaws-observability/aws-otel-js-instrumentation#79,
but in Python
This fixes the bug where:
- While the subcomponents of XRay Sampler uses ParentBased logic to
short-circuit the Parent's Sampling Decision, the XRay Sampling
Statistics recording logic is not skipped when a Parent's Sampling
Decision is found. This causes XRay Sampler to produce Sampling
Statistics based on number of Spans (regardless of Parent's Sampling
Decision), while XRay Sampler should produce Sampling Statistics based
on number of Traces (aka the number of root Spans that makes the
Sampling Decision)
### Description of changes:
1. Wrap entire XRay Sampler Internal Logic under a single ParentBased
Sampler
a. This will reduce lock contention and not over-count sampling
statistics.
3. Remove use of redundant ParentBased Sampler logic for internal
subcomponents for XRay Sampler.
### Testing:
1. Added unit tests to verify ParentBased sampling decisions
2. Original Sampler functionality tested locally using [Sampler Test
Bed](https://github.com/aws-observability/aws-otel-community/tree/master/centralized-sampling-tests)
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
Co-authored-by: Ping Xiang <[email protected]>
There is a bug of XRay Sampler Implementation in all OTel SDK Languages. This impacts Sampling Statistics reported by XRay sampler, particularly the
SamplingStatisticsDocuments
’s metrics of[BorrowCount, RequestCount, SampledCount]
, which is sent to XRay Service via the/SamplingTargets
endpoint.Example: If a single request to an Application using XRay Sampler creates
1 Server Span (makes decision Sampled=true)
with8 child Internal Spans (copies parent's Sampled value)
:Actual
: XRay Sampler will produce Sampler Metrics ofRequestCount=9, SampledCount=9
Expected
: XRay Sampler should produce Sampler Metrics ofRequestCount=1, SampledCount=1
In summary, the bug is that while Spans with a parent Span will copy their parent’s XRay Sampling Decision, they will still make additions to the XRay Sampling metric (they shouldn’t because they do not make the decision, only copy it)
How does this negatively affect OTel users of XRay Sampler?
Sampling Rules Console
, a Sampling Rule’s Trend Graph will report metric numbers that are much greater than the actual number of Traces sampled.Given the above example, the graph will incorrectly show
9 req matching the rule, with 9 sampled
instead of the actual1 req matching the rule, with 1 sampled
.Root cause should be because only subcomponents of XRay Sampler uses ParentBased logic to short-circuit the Parent's Sampling Decision, while the XRay Sampling Statistics recording logic is not skipped when a Parent's Sampling Decision is found.
The text was updated successfully, but these errors were encountered: