[dynamic control] refactor trace sampling into specific subpackage#2698
Merged
trask merged 1 commit intoopen-telemetry:mainfrom Mar 18, 2026
Merged
[dynamic control] refactor trace sampling into specific subpackage#2698trask merged 1 commit intoopen-telemetry:mainfrom
trask merged 1 commit intoopen-telemetry:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the dynamic-control “trace-sampling” policy implementation by moving all trace-sampling–related types (policy, validator, implementer, and sampler support) into a dedicated io.opentelemetry.contrib.dynamic.policy.tracesampling subpackage, keeping policy-specific code co-located as the policy set grows.
Changes:
- Moved trace sampling policy classes (validator, implementer, policy model, delegating sampler) into
policy.tracesampling. - Updated test packages/imports to match the new trace-sampling subpackage structure.
- Adjusted cross-package references to use shared policy APIs (
TelemetryPolicy,PolicyValidator,PolicyImplementer) from the parentpolicypackage.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingValidator.java | Moves validator into trace-sampling policy subpackage and updates imports. |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicyImplementer.java | Moves implementer into trace-sampling policy subpackage and updates imports. |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicy.java | Moves policy model into trace-sampling policy subpackage and updates base type import. |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/DelegatingSampler.java | Moves delegating sampler into trace-sampling policy subpackage. |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingValidatorTest.java | Updates test package/imports to align with refactor. |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicyImplementerTest.java | Updates test package/imports to align with refactor. |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/DelegatingSamplerTest.java | Updates test package to align with refactor. |
You can also share your feedback on Copilot code review. Take the survey.
LikeTheSalad
approved these changes
Mar 17, 2026
trask
approved these changes
Mar 18, 2026
Merged
via the queue into
open-telemetry:main
with commit Mar 18, 2026
e17761e
24 of 25 checks passed
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:
refactor. Moving all the trace sampling related classes into a specific policy subpackage. Looking at other policies (there are likely to be a dozen, but very unlikely to ever be more than 30), it makes sense to have anything related to a specific policy (the policy itself, the validation, the implementors and any framework supporting the implementors) together, since any change to a policy will work on those together, and they work all together
Existing Issue(s):
#2546
Testing:
Tests also refactored
Documentation:
N/A
Outstanding items:
N/A