[dynamic control] Use composable samplers and add sampler initialization#2752
Merged
jaydeluca merged 3 commits intoopen-telemetry:mainfrom Apr 9, 2026
Merged
[dynamic control] Use composable samplers and add sampler initialization#2752jaydeluca merged 3 commits intoopen-telemetry:mainfrom
jaydeluca merged 3 commits intoopen-telemetry:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds runtime sampler wiring for the dynamic-control trace-sampling policy, switching sampler creation to the newer composable/parent-threshold approach.
Changes:
- Add
TraceSamplingRatePolicy.initialize(...)to install a delegating sampler via autoconfigure. - Introduce
TraceSamplingRatePolicy.createSampler(probability)using composable/composite samplers. - Update
TraceSamplingRatePolicyImplementerto usecreateSampler(...)and log applied updates; add unit tests and incubator dependency.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicy.java | Adds initialization hook + new sampler factory using composable samplers. |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicyImplementer.java | Uses the new sampler factory (and logs) when applying policy changes. |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicyTest.java | Adds unit coverage for validation, initialization, equality/hashCode, and sampler factory behavior. |
| dynamic-control/build.gradle.kts | Adds incubator dependency required by the new sampler implementation. |
...main/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicy.java
Show resolved
Hide resolved
...o/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicyImplementer.java
Show resolved
Hide resolved
LikeTheSalad
approved these changes
Apr 9, 2026
jaydeluca
approved these changes
Apr 9, 2026
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:
Add initialization for TraceSamplingRatePolicy, and use the latest spec sampler (the expected future SDK default) of parent based trace ratio sampler. Note that the TraceSamplingRatePolicy installs an opinionated sampler. There can be other policies (in the future) which can be more generic, it's up to the user to choose which policy implementation they want to configure when creating the policy pipeline
Existing Issue(s):
#2546
Testing:
Added
Documentation:
Added
Outstanding items:
Wiring up the policy pipeline:
Steps needed for the wiring: