Add AWS X-Ray Adaptive Sampling Support#2147
Merged
trask merged 1 commit intoopen-telemetry:mainfrom Oct 20, 2025
Merged
Conversation
|
|
wangzlei
reviewed
Aug 21, 2025
wangzlei
reviewed
Aug 21, 2025
wangzlei
reviewed
Aug 21, 2025
wangzlei
reviewed
Aug 21, 2025
wangzlei
approved these changes
Oct 14, 2025
trask
reviewed
Oct 15, 2025
Member
There was a problem hiding this comment.
@majanjua-amzn @wangzlei please review new public API carefully since this module is already marked stable (if you are unsure you can always add it initially under .internal. package as an experimental feature), thanks
Contributor
Author
There was a problem hiding this comment.
We've tested and reviewed it extensively more than once as part of a contribution to https://github.com/aws-observability/aws-otel-java-instrumentation, and have also verified there is no impact on existing behaviour for those not using the new APIs.
As such, we're okay with releasing these APIs directly. Thanks for the callout!
trask
approved these changes
Oct 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Adding support for X-Ray's new Adaptive Sampling feature. The feature will allow users to detect anomalies in their application across distributed services and boost the sampling rate of their root service based on their X-Ray sampling rule configuration and optionally a user-provided SDK level configuration. It will also allow users to optionally provide an error capture configuration, where - if configured - the sampler will send unsampled anomaly spans to be exported directly:
statusCode > 499(i.e. 5XX) will be considered anomaliesThe changes:
setSpanExporterandsetAdaptiveSamplingConfigto set up the feature - if these are not provided any attempt to use theadaptSamplingAPI will throw anIllegalStateExceptionadaptSamplingthat accepts a span and its associated spanData:XrayRulesSamplerwhile ensuring the statistics are correct to ensure the adaptive sampling logic is always triggered: Ensure all XRay Sampler functionality is under ParentBased logic #1488. Implemented a unit testgenerateStatistics()to verify.W3CBaggagePropagator.getInstance().inject(context.with(baggage), setter, carrier);Testing:
tracecontext,baggage,b3,xraypropagators, and service C with the contrib changes as wellDocumentation:
https://aws.amazon.com/blogs/mt/dynamically-adjusting-x-ray-sampling-rules/
Outstanding items:
These changes are the first phase and iteration of AWS X-Ray's adaptive sampling feature. As we get feedback, more changes may be introduced to improve or streamline the experience.