[dynamic control] Add policy store#2721
Merged
trask merged 4 commits intoopen-telemetry:mainfrom Mar 27, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an initial PolicyStore component to hold the latest validated policy snapshot and avoid re-applying unchanged policies, as part of the dynamic-control “Telemetry Policy” pipeline work.
Changes:
- Introduces
PolicyStorewith snapshot update + equality-based change detection. - Adds unit tests covering update/no-op behavior, value changes, ordering changes, and empty default.
- Implements
equals/hashCodeforTelemetryPolicy(type-only instances) andTraceSamplingRatePolicy.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/PolicyStore.java | New store for policy snapshots with equality-based update detection |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/TelemetryPolicy.java | Defines equality for type-only policies (base class instances) |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicy.java | Implements equality/hash for trace sampling policy |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/PolicyStoreTest.java | Adds unit tests for PolicyStore behavior |
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/TelemetryPolicy.java
Show resolved
Hide resolved
...main/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicy.java
Outdated
Show resolved
Hide resolved
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/TelemetryPolicy.java
Outdated
Show resolved
Hide resolved
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/PolicyStore.java
Outdated
Show resolved
Hide resolved
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/PolicyStore.java
Outdated
Show resolved
Hide resolved
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/PolicyStore.java
Show resolved
Hide resolved
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/PolicyStore.java
Outdated
Show resolved
Hide resolved
…/policy/PolicyStore.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/TelemetryPolicy.java
Show resolved
Hide resolved
LikeTheSalad
approved these changes
Mar 26, 2026
trask
approved these changes
Mar 27, 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:
The policy store will be used as a middle component between ingest and application of policies. The initial implementation is simply to avoid re-applying the latest set of policies that were applied, using a simple comparison. More sophisticated prioritization strategies will be applied when the OTEP has stabilized in that area. Because equality is used, equals is now required to be implemented for policies
Existing Issue(s):
#2546
Testing:
Included in this PR
Documentation:
Included in this PR
Outstanding items:
Hooking up the policy store to the policy pipeline is still to come, I am deliberately keeping PRs small for easier review