agresch commented on a change in pull request #3307:
URL: https://github.com/apache/storm/pull/3307#discussion_r467285069



##########
File path: 
storm-client/src/jvm/org/apache/storm/metrics2/StormMetricRegistry.java
##########
@@ -153,9 +160,20 @@ public Histogram histogram(String name, TopologyContext 
context) {
         return histogram;
     }
 
+    public Histogram histogram(String name, String topologyId, String 
componentId, Integer taskId, Integer workerPort, String streamId) {
+        MetricNames metricNames = workerMetricName(name, topologyId, 
componentId, streamId, taskId, workerPort);
+        Histogram histogram = registry.histogram(metricNames.getLongName());
+        saveMetricTaskIdMapping(taskId, metricNames, histogram, 
taskIdHistograms);
+        return histogram;
+    }
+
     private static <T extends Metric> void saveMetricTaskIdMapping(Integer 
taskId, MetricNames names, T metric, Map<Integer,
             Map<String, T>> taskIdMetrics) {
         Map<String, T> metrics = taskIdMetrics.computeIfAbsent(taskId, (tid) 
-> new HashMap<>());
+        if (metrics.get(names.getV2TickName()) != null) {
+            LOG.warn("Adding duplicate short metric for " + 
names.getV2TickName()

Review comment:
       I was seeing this hit before I added the stream component to the metrics 
name such as __ack-count-$mastercoord-bg0:$batch.  It's always possible to 
register a duplicate metric name.  This just warns the user.




----------------------------------------------------------------
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:
[email protected]


Reply via email to