use of com.codahale.metrics.ExponentiallyDecayingReservoir in project jackrabbit-oak by apache.
the class MetricImplTest method timerContext.
@Test
public void timerContext() throws Exception {
VirtualClock clock = new VirtualClock();
Timer time = new Timer(new ExponentiallyDecayingReservoir(), clock);
TimerStats timerStats = new TimerImpl(time);
TimerStats.Context context = timerStats.time();
clock.tick = TimeUnit.SECONDS.toNanos(314);
context.close();
assertEquals(1, time.getCount());
assertEquals(TimeUnit.SECONDS.toNanos(314), time.getSnapshot().getMax());
}
use of com.codahale.metrics.ExponentiallyDecayingReservoir in project lucene-solr by apache.
the class MetricsConfigTest method testDefaults.
@Test
public void testDefaults() throws Exception {
NodeConfig cfg = loadNodeConfig();
SolrMetricManager mgr = new SolrMetricManager(loader, cfg.getMetricsConfig());
assertTrue(mgr.getCounterSupplier() instanceof MetricSuppliers.DefaultCounterSupplier);
assertTrue(mgr.getMeterSupplier() instanceof MetricSuppliers.DefaultMeterSupplier);
assertTrue(mgr.getTimerSupplier() instanceof MetricSuppliers.DefaultTimerSupplier);
assertTrue(mgr.getHistogramSupplier() instanceof MetricSuppliers.DefaultHistogramSupplier);
Clock clk = ((MetricSuppliers.DefaultTimerSupplier) mgr.getTimerSupplier()).clk;
assertTrue(clk instanceof Clock.UserTimeClock);
Reservoir rsv = ((MetricSuppliers.DefaultTimerSupplier) mgr.getTimerSupplier()).getReservoir();
assertTrue(rsv instanceof ExponentiallyDecayingReservoir);
}
Aggregations