[dynamic control] refactor OpampPolicyProvider for other PolicyProviders#2987
Open
jackshirazi wants to merge 5 commits into
Open
[dynamic control] refactor OpampPolicyProvider for other PolicyProviders#2987jackshirazi wants to merge 5 commits into
jackshirazi wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the dynamic-control OpAMP policy provider to extract reusable behavior needed by upcoming policy providers (e.g., file and HTTP providers), specifically around maintaining a current policy snapshot and mapping/validating incoming policy IDs into concrete policy types.
Changes:
- Introduced
AbstractPolicyProviderto centralize “current policies snapshot” storage/update + update notifications. - Introduced
MappedPolicySourceConverterto encapsulate policy-id → policy-type mapping and validator-based conversion. - Updated
OpampPolicyProviderto extend the new base class and delegate mapping/validation to the new converter.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/OpampPolicyProvider.java | Refactored to use shared snapshot management and delegated policy mapping/validation. |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/MappedPolicySourceConverter.java | New helper to map incoming policy IDs to internal policy types and validate/convert sources into TelemetryPolicy. |
| dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/policy/AbstractPolicyProvider.java | New base class providing a thread-safe immutable snapshot of current policies plus update notification helper. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
LikeTheSalad
approved these changes
Jul 13, 2026
24 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.
Description:
This is a straightforward refactor of behaviour in OpampPolicyProvider that other PolicyProviders will need to use (file and http providers). There are two separate refactors
Existing Issue(s):
#2868
Testing:
Already present, no changes needed
Documentation:
not needed for the refactoring
Outstanding items:
#2868