[dynamic control] Make TelemetryPolicy an interface#2948
Merged
Conversation
25 tasks
Contributor
There was a problem hiding this comment.
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
TelemetryPolicyinto an interface requiringgetIdentity()andgetType(), retainingisDeleted()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. |
LikeTheSalad
approved these changes
Jun 23, 2026
jaydeluca
approved these changes
Jun 23, 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:
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 .