Skip to content

[dynamic control] Register implementers#2858

Open
jackshirazi wants to merge 2 commits into
open-telemetry:mainfrom
jackshirazi:policy27
Open

[dynamic control] Register implementers#2858
jackshirazi wants to merge 2 commits into
open-telemetry:mainfrom
jackshirazi:policy27

Conversation

@jackshirazi
Copy link
Copy Markdown
Contributor

Description:

Wire up implementers so they get applied by policies.

Existing Issue(s):

#2546

Testing:

Added

Documentation:

Previously included

Outstanding items:

Wiring up the policy pipeline:

  • Generic: message -> provider -> policy -> policy handler -> implementer
  • eg "change sampling rate" message -> OpampPolicyProvider -> TraceSamplingRatePolicy -> PolicyStore -> TraceSamplingRatePolicyImplementer

Steps needed for the wiring:

  • configuring the pipeline
    • DONE: PolicyInitConfig
  • providers reading policies, eg OpampPolicyProvider, FilePolicyProvider, etc
    • DONE: OpampPolicyProvider
  • implementers applying policies, eg TraceSamplingRatePolicyImplementer
    • DONE: TraceSamplingRatePolicyImplementer
  • policy structures (eg TraceSamplingRatePolicy) that the provider converts messages into
    • DONE: TraceSamplingRatePolicy
  • registering config to policy structures (eg "trace_sampling_rate_policy" registered to TraceSamplingRatePolicy)
    • DONE: PolicyInit static initialiizer
  • initializing policy classes (eg TraceSamplingRatePolicy needs to install a custom sampler)
    • DONE: TraceSamplingRatePolicy initialization
  • activate configured providers (eg start OpampPolicyprovider reading from it's source)
    • TBD
  • register implementers for policies (eg a new TraceSamplingRatePolicy is applied by a TraceSamplingRatePolicyImplementer)
    • This PR
  • link the provider to processing policies and applying implementers
    • DONE PolicyInit

@jackshirazi jackshirazi requested a review from a team as a code owner May 22, 2026 17:59
Copilot AI review requested due to automatic review settings May 22, 2026 17:59
@github-actions github-actions Bot requested a review from LikeTheSalad May 22, 2026 17:59
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

Wires dynamic-control policy implementers into the policy pipeline so implementers are registered with PolicyStore and receive relevant policy snapshots/updates.

Changes:

  • Register initialized PolicyImplementer instances with PolicyStore during PolicyInit initialization and clear the store on shutdown.
  • Extend PolicyStore to support implementer registration and to notify implementers when policies change (filtered by supported policy types).
  • Add unit tests verifying implementers receive current and updated relevant policies.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/PolicyStoreTest.java Adds tests for implementer registration and update notifications.
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/registry/PolicyInit.java Registers implementers with the store and clears store state during shutdown.
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/PolicyStore.java Adds implementer registration, notification logic, and store clearing.

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 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines 226 to 230
try {
PolicyImplementer implementer = policyTypeInitializer.initialize(autoConfiguration);
initializedImplementers.put(policyClass, implementer);
// TODO: register implementer with policyStore, not yet implemented
// policyStore.registerImplementer(implementer);
policyStore.registerImplementer(implementer);
logger.log(Level.INFO, "Initialized policy class ''{0}''", policyClass.getName());
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.

2 participants