Skip to content

[dynamic control] Add identity to existing policy classes#2942

Merged
jaydeluca merged 3 commits into
open-telemetry:mainfrom
jackshirazi:policy-phase2-05
Jun 22, 2026
Merged

[dynamic control] Add identity to existing policy classes#2942
jaydeluca merged 3 commits into
open-telemetry:mainfrom
jackshirazi:policy-phase2-05

Conversation

@jackshirazi

Copy link
Copy Markdown
Contributor

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 .

@jackshirazi
jackshirazi requested a review from a team as a code owner June 21, 2026 20:01
Copilot AI review requested due to automatic review settings June 21, 2026 20:01
@github-actions
github-actions Bot requested a review from LikeTheSalad June 21, 2026 20:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_IDENTITY and getIdentity() on TraceSamplingRatePolicy.
  • Updates equals/hashCode for TraceSamplingRatePolicy to 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.

@jaydeluca
jaydeluca added this pull request to the merge queue Jun 22, 2026
Merged via the queue into open-telemetry:main with commit b992287 Jun 22, 2026
24 checks passed
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