Skip to content

[dynamic control] add initializing from declarative config (copy of #2881)#2967

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

[dynamic control] add initializing from declarative config (copy of #2881)#2967
jaydeluca merged 3 commits into
open-telemetry:mainfrom
jackshirazi:policy-phase2-12

Conversation

@jackshirazi

Copy link
Copy Markdown
Contributor

NOTE this is the changeset from #2881 - I tried out getting cursor to merge from main and do a tiny test fix in that PR, but now I can't get easyCLA working for cursor as co-author, so it's easier to just reapply the diff here.

Note that this PR includes all changes suggested by jackberg that I applied, and as he finished reviewing and approved that PR, I won't re-request his review.

Description:

Sorry for the change set being a little larger than normal, but I thought it was better to combine all the declarative config support changes together, rather than adding them piecemeal. I think it may be easier to understand the whole than the parts

This contains

  • a DeclarativeConfigurationCustomizerProvider that reads top-level telemetry_policy/development from declarative config and routes it into PolicyInit
  • a declarative ComponentProvider for telemetry_policy/development to add the delagating sampler - initially for the rate sampling policy, but will later make more generic (includes a TODO for that)
  • Changes to PolicyInit to support the declarative config and also make it a one-shot execution so that a later/repeated/accidental auto-config pass does not accidentally re-use stale declarative config

Existing Issue(s):

part of #2868

Testing:

Unit tests added, plus a manual end-to-end test using declarative config was performed

Documentation:

TBD see #2868

Outstanding items:

see #2868

Copilot AI review requested due to automatic review settings July 7, 2026 16:09
@jackshirazi
jackshirazi requested a review from a team as a code owner July 7, 2026 16:09
@github-actions
github-actions Bot requested a review from LikeTheSalad July 7, 2026 16:13

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 declarative-config support to the dynamic-control module so telemetry policy initialization can be driven from a top-level telemetry_policy/development block and/or a declarative sampler component, integrating this into the existing PolicyInit bootstrap flow.

Changes:

  • Introduces a DeclarativeConfigurationCustomizerProvider that extracts telemetry_policy/development from top-level declarative config and routes it into PolicyInit.
  • Adds a declarative ComponentProvider sampler (telemetry_policy/development) to bootstrap policy wiring via declarative config.
  • Updates PolicyInit to support one-shot initialization from the parsed top-level declarative config, and adds unit tests for both paths.

Reviewed changes

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

Show a summary per file
File Description
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/TelemetryPolicyDeclarativeCustomizerProvider.java Reads top-level telemetry_policy/development, parses it into PolicyInitConfig, and installs a sampler component config when applicable.
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/TelemetryPolicySamplerComponentProvider.java Adds a declarative sampler component that initializes policies from component config and returns an initialized delegating sampler (or a fallback).
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/registry/PolicyInit.java Adds one-shot handoff for top-level declarative init config into the auto-config bootstrap path.
dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/TelemetryPolicyDeclarativeCustomizerProviderTest.java Unit tests for top-level telemetry policy parsing and bootstrap behavior.
dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/TelemetryPolicySamplerComponentProviderTest.java Unit tests for sampler component initialization behavior with/without telemetry policy config.
dynamic-control/build.gradle.kts Adds declarative-config bridge dependency and pins declarative-config extension version.

Comment thread dynamic-control/build.gradle.kts
Comment thread dynamic-control/build.gradle.kts
@jaydeluca
jaydeluca added this pull request to the merge queue Jul 7, 2026
Merged via the queue into open-telemetry:main with commit b5f764f 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.

3 participants