[dynamic control] propagate SourceKind across validation and policy creation#2973
Merged
Merged
Conversation
25 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the dynamic-control policy pipeline to propagate a SourceKind (e.g., OPAMP vs FILE) through validation and into created TelemetryPolicy instances, enabling later spec-compliant source-priority handling.
Changes:
- Extends
PolicyValidator/AbstractSourcePolicyValidatorvalidation APIs to accept aSourceKindand threads it through JSON/key-value validation paths. - Updates OpAMP and file-based policy providers to pass the correct
SourceKindinto validation. - Expands unit tests to assert that validated/constructed policies retain the provided source kind.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/PolicyValidator.java | Extends validator API to accept SourceKind during validation. |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/AbstractSourcePolicyValidator.java | Propagates SourceKind through source-format dispatch and into abstract validation hooks. |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingValidator.java | Passes SourceKind through trace-sampling policy validation and construction. |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/OpampPolicyProvider.java | Supplies SourceKind.OPAMP when validating parsed OpAMP policies. |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/LinePerPolicyFileProvider.java | Supplies SourceKind.FILE when validating policies read from a file. |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingValidatorTest.java | Asserts validator propagates SourceKind into produced policies. |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicyTest.java | Asserts policy constructors store default/explicit SourceKind. |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/tracesampling/TraceSamplingRatePolicyImplementerTest.java | Updates test policy stubs to implement getSourceKind(). |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/registry/PolicyInitTest.java | Updates test policy stubs to carry SourceKind. |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/LinePerPolicyFileProviderTest.java | Asserts file provider results carry SourceKind.FILE and updates validator stub signature. |
| dynamic-control/src/test/java/io/opentelemetry/contrib/dynamic/policy/DeletedTelemetryPolicyTest.java | Asserts deleted policies retain default/explicit SourceKind and updates stubs. |
LikeTheSalad
approved these changes
Jul 9, 2026
jaydeluca
approved these changes
Jul 13, 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:
This PR is mainly the addition of a SourceKind parameter to methods, plus additional tests.
The spec requires opamp > http > file priority of policies so if mergeable policies are received by more than one source in an update, the highest priority policy is retained and the others dropped. This PR propagates the source and starts using the source-aware policies. Dropping the policies is implemented in a following PR
Existing Issue(s):
#2868
Testing:
not yet
Documentation:
n/a
Outstanding items:
Still to implement
Also #2868