xiaodongdu commented on a change in pull request #8691:
URL: https://github.com/apache/kafka/pull/8691#discussion_r429683408



##########
File path: 
connect/runtime/src/main/java/org/apache/kafka/connect/util/ConnectUtils.java
##########
@@ -65,4 +68,12 @@ static String lookupKafkaClusterId(Admin adminClient) {
                                        + "Check worker's broker connection and 
security properties.", e);
         }
     }
+
+    public static void addMetricsContextProperties(Map<String, Object> prop, 
WorkerConfig config, String clusterId) {
+        //add all properties predefined with "metrics.context."
+        
prop.putAll(config.originalsWithPrefix(CommonClientConfigs.METRICS_CONTEXT_PREFIX,
 false));
+        //add connect properties
+        prop.put(CommonClientConfigs.METRICS_CONTEXT_PREFIX + 
WorkerConfig.CONNECT_KAFKA_CLUSTER_ID, clusterId);
+        prop.put(CommonClientConfigs.METRICS_CONTEXT_PREFIX + 
WorkerConfig.CONNECT_GROUP_ID, 
config.originals().get(DistributedConfig.GROUP_ID_CONFIG));

Review comment:
       Added unit test in ConnectUtilsTest for StandAloneConfig and 
DistributedConfig.




----------------------------------------------------------------
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.

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


Reply via email to