Skip to content

[dynamic control] Add SourceKind to TelemetryPolicy#2972

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

[dynamic control] Add SourceKind to TelemetryPolicy#2972
jaydeluca merged 2 commits into
open-telemetry:mainfrom
jackshirazi:policy-phase2-15

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. This adds source to the policies, but unused and untested for now - the "Still to implement" section shows next steps, tests are added when source starts being used

Existing Issue(s):

#2868

Testing:

not yet

Documentation:

n/a

Outstanding items:

Still to implement

  • retaining source in the policies
    • add source to validators
    • in providers use new source-enabled validators to create new source aware policies
    • drop now unused methods/constructors/defaults which are not source aware
  • dropping lower priority policies in an update when the policies are otherwise mergeable in an update, by changing policy aggregation in the PolicyStore

Also #2868

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

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

This PR adds a SourceKind attribute to the dynamic-control TelemetryPolicy model so policies can later be prioritized/deduplicated by their originating source (OpAMP > HTTP > file) per spec requirements.

Changes:

  • Added TelemetryPolicy#getSourceKind() (defaulting to SourceKind.CUSTOM for now).
  • Plumbed SourceKind through TraceSamplingRatePolicy and DeletedTelemetryPolicy via new fields/constructors and overrides.
  • Updated DeletedTelemetryPolicy#toString() to include sourceKind.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicy.java Stores and exposes SourceKind for trace-sampling policies via new constructor/override.
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/TelemetryPolicy.java Introduces getSourceKind() on the policy interface (default implementation for transition).
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/DeletedTelemetryPolicy.java Stores/exposes SourceKind for deletion markers and includes it in toString().

@jaydeluca
jaydeluca added this pull request to the merge queue Jul 9, 2026
Merged via the queue into open-telemetry:main with commit 93457ac Jul 9, 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