-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
Search before asking
- I had searched in the issues and found no similar issues.
Apache SkyWalking Component
Java Agent (apache/skywalking-java)
What happened
When registering AgentConfigChangeWatcher in dynamic configuration, there may be different AgentConfigChangeWatchers using the same propertyKey. Although there are currently no such cases in skywalking-java, but this situation should have been taken into consideration in the previous design. For example:
private final Map<String, List<WatcherHolder>> register = new HashMap<>();
The same key can correspond to multiple WatcherHolders .
There is a logic in org.apache.skywalking.apm.agent.core.conf.dynamic.ConfigurationDiscoveryService#getAgentDynamicConfig():
// Some plugin will register watcher later.
final int size = register.keys().size();
if (lastRegisterWatcherSize != size) {
// reset uuid, avoid the same uuid causing the configuration not to be updated.
uuid = null;
lastRegisterWatcherSize = size;
}
The situation where the number of keys remains unchanged, but the number of WatcherHolders corresponding to keys increases, was not considered here. If some plugins will register watchers later, but the keys they use are the same as those in the previous register, then the uuid will not be reset and these configurations will not be updated.
What you expected to happen
No response
How to reproduce
No response
Anything else
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct