[dynamic control] add initializing from declarative config (copy of #2881)#2967
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
DeclarativeConfigurationCustomizerProviderthat extractstelemetry_policy/developmentfrom top-level declarative config and routes it intoPolicyInit. - Adds a declarative
ComponentProvidersampler (telemetry_policy/development) to bootstrap policy wiring via declarative config. - Updates
PolicyInitto 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. |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
jaydeluca
approved these changes
Jul 7, 2026
25 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
DeclarativeConfigurationCustomizerProviderthat reads top-leveltelemetry_policy/developmentfrom declarative config and routes it intoPolicyInitComponentProviderfortelemetry_policy/developmentto add the delagating sampler - initially for the rate sampling policy, but will later make more generic (includes a TODO for that)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