guozhangwang commented on code in PR #12287:
URL: https://github.com/apache/kafka/pull/12287#discussion_r896037230


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/metrics/StreamsMetricsImpl.java:
##########
@@ -502,9 +502,8 @@ public <T> void addStoreLevelMutableMetric(final String 
taskId,
             storeLevelTagMap(taskId, metricsScope, storeName)
         );
         if (metrics.metric(metricName) == null) {
-            final MetricConfig metricConfig = new 
MetricConfig().recordLevel(recordingLevel);
+            metrics.addMetricIfAbsent(metricName, new 
MetricConfig().recordLevel(recordingLevel), valueProvider);

Review Comment:
   Just take here as an example: here we depend on two threads would not try to 
create the same store-name and the same task-id but that may not always hold 
true in the future, so better using the newly introduced API. cc @cadonna .



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to