[dynamic control] Add identity to existing policy classes#2942
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds the previously introduced TelemetryPolicyIdentity to the existing trace sampling policy implementation in dynamic-control, and updates tests to validate the default identity is present.
Changes:
- Introduces a
DEFAULT_IDENTITYandgetIdentity()onTraceSamplingRatePolicy. - Updates
equals/hashCodeforTraceSamplingRatePolicyto include identity. - Extends validator and policy unit tests to assert the default identity.
Reviewed changes
Copilot reviewed 3 out of 3 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 default identity + accessor, and incorporates identity into equality/hash logic. |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicyTest.java | Adds an assertion that constructed policies carry the default identity. |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingValidatorTest.java | Adds assertions that validated policies expose the default identity. |
25 tasks
LikeTheSalad
approved these changes
Jun 22, 2026
jaydeluca
approved these changes
Jun 22, 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:
Identity was added in #2926, now I'm adding it to the only policy defined so far.
Note 1: I haven't added virtual identity to the base class because that will become an interface (per previous review feedback)
Note 2: There is no benefit to changing identity for the trace sampling policy because it's a global change so should only have one identity. So there is no mechanism to change identity from the default for this policy. Other policies added in the future will have identity mutation.
Existing Issue(s):
part of #2868
Testing:
Added
Documentation:
Added previously, see README
Outstanding items:
see #2868 .