Skip to content

[dynamic control] Add policy store#2721

Merged
trask merged 4 commits intoopen-telemetry:mainfrom
jackshirazi:policy15
Mar 27, 2026
Merged

[dynamic control] Add policy store#2721
trask merged 4 commits intoopen-telemetry:mainfrom
jackshirazi:policy15

Conversation

@jackshirazi
Copy link
Copy Markdown
Contributor

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

@jackshirazi jackshirazi requested a review from a team as a code owner March 25, 2026 21:02
Copilot AI review requested due to automatic review settings March 25, 2026 21:02
@github-actions github-actions bot requested a review from LikeTheSalad March 25, 2026 21:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 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 PolicyStore with snapshot update + equality-based change detection.
  • Adds unit tests covering update/no-op behavior, value changes, ordering changes, and empty default.
  • Implements equals/hashCode for TelemetryPolicy (type-only instances) and TraceSamplingRatePolicy.

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

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

…/policy/PolicyStore.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@trask trask added this pull request to the merge queue Mar 27, 2026
Merged via the queue into open-telemetry:main with commit 70b0ac9 Mar 27, 2026
21 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