Skip to content

[dynamic control] Align aggregation to spec#2960

Merged
jaydeluca merged 3 commits into
open-telemetry:mainfrom
jackshirazi:policy-phase2-11
Jul 7, 2026
Merged

[dynamic control] Align aggregation to spec#2960
jaydeluca merged 3 commits into
open-telemetry:mainfrom
jackshirazi:policy-phase2-11

Conversation

@jackshirazi

Copy link
Copy Markdown
Contributor

Description:

The policy aggregator spec covers several concerns. Two relevant rules are:

  • Policies of different types cannot be merged, but policies of the same type MUST be merged together.
  • When multiple providers supply a policy with the same ID, the policy from the higher-priority provider wins and the other is dropped.

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

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

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 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/hashCode for 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.

jackshirazi and others added 2 commits July 6, 2026 12:34
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@jackshirazi jackshirazi changed the title Align aggregation to spec [dynamic control] Align aggregation to spec Jul 6, 2026
@jaydeluca
jaydeluca added this pull request to the merge queue Jul 7, 2026
Merged via the queue into open-telemetry:main with commit 4cc2638 Jul 7, 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