Search in sources :

Example 6 with ExponentiallyDecayingReservoir

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());
}
Also used : ExponentiallyDecayingReservoir(com.codahale.metrics.ExponentiallyDecayingReservoir) Timer(com.codahale.metrics.Timer) TimerStats(org.apache.jackrabbit.oak.stats.TimerStats) Test(org.junit.Test)

Example 7 with ExponentiallyDecayingReservoir

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);
}
Also used : ExponentiallyDecayingReservoir(com.codahale.metrics.ExponentiallyDecayingReservoir) Reservoir(com.codahale.metrics.Reservoir) ExponentiallyDecayingReservoir(com.codahale.metrics.ExponentiallyDecayingReservoir) UniformReservoir(com.codahale.metrics.UniformReservoir) SlidingTimeWindowReservoir(com.codahale.metrics.SlidingTimeWindowReservoir) Clock(com.codahale.metrics.Clock) NodeConfig(org.apache.solr.core.NodeConfig) Test(org.junit.Test)

Aggregations

ExponentiallyDecayingReservoir (com.codahale.metrics.ExponentiallyDecayingReservoir)7 Test (org.junit.Test)4 Timer (com.codahale.metrics.Timer)3 Clock (com.codahale.metrics.Clock)2 Reservoir (com.codahale.metrics.Reservoir)2 SlidingTimeWindowReservoir (com.codahale.metrics.SlidingTimeWindowReservoir)2 UniformReservoir (com.codahale.metrics.UniformReservoir)2 TimerStats (org.apache.jackrabbit.oak.stats.TimerStats)2 SlidingWindowReservoir (com.codahale.metrics.SlidingWindowReservoir)1 InetAddress (java.net.InetAddress)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 NodeConfig (org.apache.solr.core.NodeConfig)1 PluginInfoInitialized (org.apache.solr.util.plugin.PluginInfoInitialized)1