You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "xlq20080808 (via GitHub)" <gi...@apache.org> on 2023/03/08 02:59:55 UTC

[GitHub] [skywalking] xlq20080808 commented on a diff in pull request #10476: Feature DCS supports global configuration

xlq20080808 commented on code in PR #10476:
URL: https://github.com/apache/skywalking/pull/10476#discussion_r1128918186


##########
oap-server/server-receiver-plugin/configuration-discovery-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/recevier/configuration/discovery/AgentConfigurationsReader.java:
##########
@@ -54,6 +54,9 @@ public AgentConfigurationsTable readAgentConfigurationsTable() {
                 if (configurationsData != null) {
                     configurationsData.forEach((k, v) -> {
                         Map map = (Map) v;
+                        if (configurationsData.containsKey("default-config")) {
+                            ((Map) configurationsData.get("default-config")).forEach(map::putIfAbsent);
+                        }

Review Comment:
   We need to add the missing configuration items of each service in default-config to the each service configuration, I think they should be similar to union relationship. And then we will traverse the map to generate UUID for each service



##########
oap-server/server-receiver-plugin/configuration-discovery-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/recevier/configuration/discovery/AgentConfigurationsWatcher.java:
##########
@@ -73,7 +73,7 @@ public String value() {
     public AgentConfigurations getAgentConfigurations(String service) {
         AgentConfigurations agentConfigurations = agentConfigurationsTable.getAgentConfigurationsCache().get(service);
         if (null == agentConfigurations) {
-            return emptyAgentConfigurations;
+            return agentConfigurationsTable.getAgentConfigurationsCache().getOrDefault("default-config", emptyAgentConfigurations);

Review Comment:
   I think the priority is this. If there is a configuration for a single service, it is returned, and it also carries the configuration after the union with `default config`. If there is no separate configuration, the `default-config` is returned. If `default-config` is not set, the empty configuration is returned
   



##########
oap-server/server-receiver-plugin/configuration-discovery-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/recevier/configuration/discovery/AgentConfigurationsWatcher.java:
##########
@@ -73,7 +73,7 @@ public String value() {
     public AgentConfigurations getAgentConfigurations(String service) {
         AgentConfigurations agentConfigurations = agentConfigurationsTable.getAgentConfigurationsCache().get(service);
         if (null == agentConfigurations) {
-            return emptyAgentConfigurations;
+            return agentConfigurationsTable.getAgentConfigurationsCache().getOrDefault("default-config", emptyAgentConfigurations);

Review Comment:
   Please correct my mistakes



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org