[dynamic control] add config parsing for both json and yaml#2738
Merged
jaydeluca merged 9 commits intoopen-telemetry:mainfrom Apr 7, 2026
Merged
[dynamic control] add config parsing for both json and yaml#2738jaydeluca merged 9 commits intoopen-telemetry:mainfrom
jaydeluca merged 9 commits intoopen-telemetry:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds initial configuration parsing support for the dynamic-control policy registry, allowing the registry init model to be constructed from either JSON or YAML payloads/files.
Changes:
- Introduces a shared
JsonNode-based parser (JsonNodePolicyInitConfigParser) that converts config intoPolicyInitConfig. - Adds JSON and YAML
PolicyInitConfigReaderimplementations backed by Jackson (withYAMLFactoryfor YAML). - Adds unit tests for JSON/YAML reader behavior and validation errors; adds YAML Jackson dependency.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/registry/json/JsonNodePolicyInitConfigParser.java | Implements shared JsonNode → model parsing and validation logic. |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/registry/json/PolicyInitConfigReader.java | Adds JSON reader that parses into JsonNode then delegates to the shared parser. |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/registry/yaml/PolicyInitConfigReader.java | Adds YAML reader using Jackson YAMLFactory, delegating to the shared parser. |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/registry/json/PolicyInitConfigReaderTest.java | Adds JSON reader tests (fixture + validation error cases). |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/registry/yaml/PolicyInitConfigReaderTest.java | Adds YAML reader tests (fixture + validation error cases). |
| dynamic-control/build.gradle.kts | Adds jackson-dataformat-yaml dependency for YAML parsing support. |
jackshirazi
commented
Apr 3, 2026
jackshirazi
commented
Apr 3, 2026
jackshirazi
commented
Apr 3, 2026
Co-authored-by: jackshirazi <[email protected]>
LikeTheSalad
reviewed
Apr 7, 2026
LikeTheSalad
approved these changes
Apr 7, 2026
jaydeluca
reviewed
Apr 7, 2026
|
|
||
| private static final ObjectMapper MAPPER = new ObjectMapper(new YAMLFactory()); | ||
|
|
||
| public PolicyInitConfig read(InputStream in) throws IOException { |
Member
There was a problem hiding this comment.
since these reader classes don't have any state, could they be static utility classes like JsonNodePolicyInitConfigParser?
Contributor
Author
There was a problem hiding this comment.
Yes, good call. If they need to be polymorphic we can move them back to instance methods but per your point I've made them static now
jaydeluca
approved these changes
Apr 7, 2026
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.
Description:
Adding parsing for json and yaml of initialization of the Policy pipeline for examples like the following json or yaml
Existing Issue(s):
#2546
Testing:
Added
Documentation:
to be added
Outstanding items:
Still to hook up config to actual policy and build the pipeline