maedhroz commented on a change in pull request #1091:
URL: https://github.com/apache/cassandra/pull/1091#discussion_r663138322
##########
File path: src/java/org/apache/cassandra/metrics/CassandraMetricsRegistry.java
##########
@@ -98,19 +99,51 @@ public Histogram histogram(MetricName name, MetricName
alias, boolean considerZe
public Timer timer(MetricName name)
{
- Timer timer = register(name, new Timer(new
DecayingEstimatedHistogramReservoir()));
+ return timer(name, TimeUnit.MICROSECONDS);
+ }
+
+ public Timer timer(MetricName name, MetricName alias)
+ {
+ return timer(name, alias, TimeUnit.MICROSECONDS);
+ }
+
+ public Timer timer(MetricName name, TimeUnit durationUnit)
+ {
+ Timer timer = register(name, createTimer(durationUnit));
registerMBean(timer, name.getMBeanName());
return timer;
}
- public Timer timer(MetricName name, MetricName alias)
+ public Timer timer(MetricName name, MetricName alias, TimeUnit
durationUnit)
{
- Timer timer = timer(name);
+ Timer timer = timer(name, durationUnit);
registerAlias(name, alias);
return timer;
}
+ @VisibleForTesting
+ Timer createTimer(TimeUnit durationUnit)
+ {
+ Reservoir reservoir;
+ if (durationUnit != TimeUnit.NANOSECONDS)
+ {
+ Reservoir underlying = new
DecayingEstimatedHistogramReservoir(false,
Review comment:
nit: Might make sense to replace `false` w/ `DEFAULT_ZERO_CONSIDERATION`
--
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]