Skip to content

[dynamic control] Add priority ordering to sources#2970

Merged
jaydeluca merged 2 commits into
open-telemetry:mainfrom
jackshirazi:policy-phase2-14
Jul 8, 2026
Merged

[dynamic control] Add priority ordering to sources#2970
jaydeluca merged 2 commits into
open-telemetry:mainfrom
jackshirazi:policy-phase2-14

Conversation

@jackshirazi

Copy link
Copy Markdown
Contributor

Description:

The spec requires opamp > http > file priority of policies so if mergeable policies are received by more than one source in an update, the highest priority policy is retained and the others dropped

Existing Issue(s):

#2868

Testing:

added

Documentation:

n/a

Outstanding items:

Still to implement

  • retaining source in the policies
  • dropping lower priority policies in an update when the policies are otherwise mergeable in an update

Also #2868

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

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

Adds an explicit source-priority concept to dynamic-control policy sources to support spec-required precedence when multiple sources provide the same policy ID (OpAMP > HTTP > file).

Changes:

  • Added a numeric priority field to SourceKind with spec-aligned values for OPAMP/HTTP/FILE (and a low-priority default for CUSTOM).
  • Exposed priority via priority() and added hasHigherPriorityThan(SourceKind other) for comparisons.

@LikeTheSalad LikeTheSalad 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.

Not sure if relevant, but this makes me wonder what would happen if 2 sources have the same priority? Or are there going to be mechanisms before reaching this part that prevent that from happening?

@jaydeluca
jaydeluca added this pull request to the merge queue Jul 8, 2026
Merged via the queue into open-telemetry:main with commit bd125c8 Jul 8, 2026
24 checks passed
@jackshirazi

Copy link
Copy Markdown
Contributor Author

@LikeTheSalad

Not sure if relevant, but this makes me wonder what would happen if 2 sources have the same priority? Or are there going to be mechanisms before reaching this part that prevent that from happening?

Nothing prevents the same source sending the same policy with two different values at the same time. For example sending sampling rate at 50% and 10% at the same time. The spec says these should be "merged". Merged here could only mean dropping one. Which one is up to the implementation. In the full data structure, there would be a timestamp in the policy, and you could choose to keep the latter. But even the timestamps could be the same. The implementation currently just chooses one. Specifically the current implementation keeps the first one read from the data structure.

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