You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2021/08/16 23:24:03 UTC
[GitHub] [cassandra] jonmeredith commented on a change in pull request #1146: CASSANDRA-16859 - allow blocking IPs from updating metrics about traffic
jonmeredith commented on a change in pull request #1146:
URL: https://github.com/apache/cassandra/pull/1146#discussion_r689923265
##########
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:
TODO left over - what to do?
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org