[dynamic control] Align aggregation to spec#2960
Merged
Merged
Conversation
25 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the dynamic-control PolicyStore aggregation behavior to better match the policy aggregator spec by treating (policyType, policyId) as the identity key, and by always accepting snapshots (leaving no-op detection to providers / idempotency to implementers).
Changes:
- Normalize incoming policy snapshots by
(type, id)and drop duplicate identities (keeping first occurrence in insertion order). - Remove value-equality-based no-op detection so repeated / reordered snapshots are still accepted and published.
- Update unit tests to assert behavior without relying on policy
equals/hashCodefor effective-change detection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/PolicyStore.java | Normalize policies by (type, id) via a PolicyKey map and always accept updates while still emitting deleted-policy notifications. |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/PolicyStoreTest.java | Adjust tests to reflect new “always accept” semantics and identity-based deduplication behavior. |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LikeTheSalad
approved these changes
Jul 7, 2026
jaydeluca
approved these changes
Jul 7, 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 aggregator spec covers several concerns. Two relevant rules are:
In other words, policy type determines which policies participate in the same policy-type merge or runtime resolution, while policy ID identifies duplicate policy instances across providers. This implementation does not yet support provider prioritization, so within a single update it normalizes policies by
(type, id)and drops all but one policy with the same key.In practice, having more than one policy with the same type and id is unlikely in any one update
Note that this implementation change means there is no longer any need for policies to adapt equals/hashcode, so those method overrides will be dropped in a future PR
Existing Issue(s):
#2868
Testing:
added
Documentation:
n/a
Outstanding items:
#2868