dcapwell commented on a change in pull request #1146:
URL: https://github.com/apache/cassandra/pull/1146#discussion_r689931914



##########
File path: 
test/distributed/org/apache/cassandra/distributed/impl/InstanceMetrics.java
##########
@@ -45,16 +45,32 @@
         this.metricsRegistry = metricsRegistry;
     }
 
+    @Override
     public List<String> getNames()
     {
         return new ArrayList<>(metricsRegistry.getNames());
     }
 
+    @Override
     public long getCounter(String name)
     {
-        return metricsRegistry.getCounters().get(name).getCount();
+        Counter counter = metricsRegistry.getCounters().get(name);
+        if (counter != null)
+            return counter.getCount();
+        Meter meter = metricsRegistry.getMeters().get(name);
+        if (meter != null)
+            return meter.getCount();
+        Histogram histogram = metricsRegistry.getHistograms().get(name);
+        if (histogram != null)
+            return histogram.getCount();
+        Timer timer = metricsRegistry.getTimers().get(name);
+        if (timer != null)
+            return timer.getCount();
+        //TODO no way to handle not found other than NPE?

Review comment:
       this is mostly me documenting that the jvm-dtest api exposes a `long` so 
"does not exist" returns a NPE atm (and without this patch)




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to