Skip to content

[dynamic control] Make TelemetryPolicy an interface#2948

Merged
jaydeluca merged 1 commit into
open-telemetry:mainfrom
jackshirazi:policy-phase2-08
Jun 23, 2026
Merged

[dynamic control] Make TelemetryPolicy an interface#2948
jaydeluca merged 1 commit into
open-telemetry:mainfrom
jackshirazi:policy-phase2-08

Conversation

@jackshirazi

Copy link
Copy Markdown
Contributor

Description:

Feedback during previous reviews recommended moving TelemetryPolicy to an interface, and not using it as a "deleted policy" instance. This is the last step of that

Existing Issue(s):

part of #2868

Testing:

Added

Documentation:

Added

Outstanding items:

see #2868 .

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

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

Updates the dynamic-control extension’s telemetry policy model by converting TelemetryPolicy from a concrete base class into an interface with required policy identity, aligning with prior review feedback and the spec’s identity requirements.

Changes:

  • Converted TelemetryPolicy into an interface requiring getIdentity() and getType(), retaining isDeleted() as a default method.
  • Updated core policy implementations and store logic (TraceSamplingRatePolicy, DeletedTelemetryPolicy, PolicyStore) to match the new interface and identity handling.
  • Updated affected tests to use lightweight test policy implementations instead of instantiating the former base class.

Reviewed changes

Copilot reviewed 9 out of 9 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/TelemetryPolicy.java Converted TelemetryPolicy from class to interface with required identity + type.
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/PolicyStore.java Updated deletion tracking/keying to assume identity is always present.
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/DeletedTelemetryPolicy.java Updated to implement the new TelemetryPolicy interface and carry type explicitly.
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicy.java Updated to implement TelemetryPolicy and provide getType().
dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicyImplementerTest.java Replaced base-class instantiation with a test TelemetryPolicy implementation.
dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/registry/PolicyInitTest.java Updated idempotent test policy to implement TelemetryPolicy + identity.
dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/PolicyStoreTest.java Updated tests to use identity-bearing unrelated policies via a test implementation.
dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/LinePerPolicyFileProviderTest.java Updated validator test to return an identity-bearing test policy implementation.
dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/DeletedTelemetryPolicyTest.java Updated “ordinary policy” test to use a test TelemetryPolicy implementation.

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