[OpAMP] Remote config -> effective config feedback#2898
Conversation
# Conflicts: # opamp/src/main/java/com/splunk/opentelemetry/opamp/OpampActivator.java # opamp/src/main/java/com/splunk/opentelemetry/opamp/RemoteConfigProcessor.java # opamp/src/main/java/com/splunk/opentelemetry/opamp/ServerToAgentMessageHandler.java # opamp/src/test/java/com/splunk/opentelemetry/opamp/RemoteConfigProcessorTest.java # profiler/src/main/java/com/splunk/opentelemetry/profiler/JfrAgentListener.java # profiler/src/main/java/com/splunk/opentelemetry/profiler/PeriodicRecordingFlusher.java
Sending effective config when configuration changed
| import java.time.Duration; | ||
|
|
||
| public interface ProfilerConfiguration { | ||
| OptionalConfigurableSupplier<ProfilerConfiguration> SUPPLIER = |
There was a problem hiding this comment.
[for reviewer] Now both implementations of ProfilerConfiguration interface are accessible through the same SUPPLIER. Depending on configuration flavor - SUPPLIER will serve appropriate type of configuration. Before this refactoring ProfilerEnvVarsConfiguration was created in multiple places. Now it is instantiated only once, which is OK since ConfigProperties is immutable after SDK is initialized. It was necessary to support profiler remote config in a uniform way.
| DeclarativeConfigurationCustomizerProvider.class, | ||
| AutoConfigurationCustomizerProvider.class | ||
| }) | ||
| public class ProfilerConfigurationInitializer |
There was a problem hiding this comment.
[for reviewer] This class supports environment and declarative configuration. Appropriate method is called to init SUPPLIER with right profiler configuration kind, depending on agent configuration flavor used.
| import opamp.proto.AgentConfigFile; | ||
| import opamp.proto.AgentConfigMap; | ||
|
|
||
| public class EffectiveConfigReporter { |
There was a problem hiding this comment.
[for reviewer] This class keeps recently reported effective config and reports a new effective config only if the content changed.
Maybe it is not the most effective way of handling effective config reporting but it is a good start. I'm open to any improvement ideas.
There was a problem hiding this comment.
[for reviewer] This class is a proxy over original configuration. Original profiler configuration is immutable once created. This class overwrites handling of the properties that are updatable via remote configuration, while preserving original values.
I'm still considering introducing a mutable ProfilerConfiguration interface implementation and letting appropriate factories to set it up. This would be served via SUPPLIER without any proxy objects.
No description provided.