Skip to content

[dynamic control] refactor trace sampling into specific subpackage#2698

Merged
trask merged 1 commit intoopen-telemetry:mainfrom
jackshirazi:policy9
Mar 18, 2026
Merged

[dynamic control] refactor trace sampling into specific subpackage#2698
trask merged 1 commit intoopen-telemetry:mainfrom
jackshirazi:policy9

Conversation

@jackshirazi
Copy link
Copy Markdown
Contributor

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

@jackshirazi jackshirazi requested a review from a team as a code owner March 17, 2026 12:41
Copilot AI review requested due to automatic review settings March 17, 2026 12:41
@github-actions github-actions Bot requested a review from LikeTheSalad March 17, 2026 12:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 parent policy package.

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.

@trask trask added this pull request to the merge queue Mar 18, 2026
Merged via the queue into open-telemetry:main with commit e17761e Mar 18, 2026
24 of 25 checks passed
@jackshirazi jackshirazi deleted the policy9 branch April 1, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants