Search in sources :

Example 36 with MetricRegistry

use of com.codahale.metrics.MetricRegistry in project jackrabbit-oak by apache.

the class OutOfBandIndexer method configureEstimators.

private void configureEstimators(IndexUpdate indexUpdate) {
    StatisticsProvider statsProvider = indexHelper.getStatisticsProvider();
    if (statsProvider instanceof MetricStatisticsProvider) {
        MetricRegistry registry = ((MetricStatisticsProvider) statsProvider).getRegistry();
        indexUpdate.setTraversalRateEstimator(new MetricRateEstimator(REINDEX_LANE, registry));
    }
    NodeCounterMBeanEstimator estimator = new NodeCounterMBeanEstimator(indexHelper.getNodeStore());
    indexUpdate.setNodeCountEstimator(estimator);
}
Also used : MetricRegistry(com.codahale.metrics.MetricRegistry) MetricRateEstimator(org.apache.jackrabbit.oak.plugins.index.progress.MetricRateEstimator) MetricStatisticsProvider(org.apache.jackrabbit.oak.plugins.metric.MetricStatisticsProvider) MetricStatisticsProvider(org.apache.jackrabbit.oak.plugins.metric.MetricStatisticsProvider) StatisticsProvider(org.apache.jackrabbit.oak.stats.StatisticsProvider) NodeCounterMBeanEstimator(org.apache.jackrabbit.oak.plugins.index.progress.NodeCounterMBeanEstimator)

Example 37 with MetricRegistry

use of com.codahale.metrics.MetricRegistry in project sling by apache.

the class MetricWebConsolePlugin method addingService.

//~---------------------------------------------< ServiceTracker >
@Override
public MetricRegistry addingService(ServiceReference<MetricRegistry> serviceReference) {
    MetricRegistry registry = context.getService(serviceReference);
    registries.put(serviceReference, registry);
    return registry;
}
Also used : MetricRegistry(com.codahale.metrics.MetricRegistry)

Example 38 with MetricRegistry

use of com.codahale.metrics.MetricRegistry in project sling by apache.

the class JSONReporterTest method nan_value.

@SuppressWarnings("unchecked")
@Test
public void nan_value() throws Exception {
    MetricRegistry registry = new MetricRegistry();
    registry.register("test", new Gauge<Double>() {

        @Override
        public Double getValue() {
            return Double.POSITIVE_INFINITY;
        }
    });
    Map<String, Object> json = getJSON(registry);
    assertTrue(((Map<String, Object>) json.get("gauges")).containsKey("test"));
}
Also used : MetricRegistry(com.codahale.metrics.MetricRegistry) Test(org.junit.Test)

Example 39 with MetricRegistry

use of com.codahale.metrics.MetricRegistry in project sling by apache.

the class MetricWebConsolePluginTest method inventory_text.

@Test
public void inventory_text() throws Exception {
    MetricRegistry reg1 = new MetricRegistry();
    reg1.meter("test1").mark(5);
    context.registerService(MetricRegistry.class, reg1, regProps("foo"));
    activatePlugin();
    StringWriter sw = new StringWriter();
    plugin.print(new PrintWriter(sw), Format.TEXT, false);
    String out = sw.toString();
    assertThat(out, containsString("foo:test1"));
    assertThat(out, containsString("Meters"));
}
Also used : StringWriter(java.io.StringWriter) MetricRegistry(com.codahale.metrics.MetricRegistry) Matchers.containsString(org.hamcrest.Matchers.containsString) PrintWriter(java.io.PrintWriter) Test(org.junit.Test)

Example 40 with MetricRegistry

use of com.codahale.metrics.MetricRegistry in project spring-boot by spring-projects.

the class MetricRepositoryAutoConfigurationTests method dropwizardInstalledIfPresent.

@Test
public void dropwizardInstalledIfPresent() {
    this.context = new AnnotationConfigApplicationContext(MetricsDropwizardAutoConfiguration.class, MetricRepositoryAutoConfiguration.class, AopAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(GaugeService.class);
    assertThat(gaugeService).isNotNull();
    gaugeService.submit("foo", 2.7);
    DropwizardMetricServices exporter = this.context.getBean(DropwizardMetricServices.class);
    assertThat(exporter).isEqualTo(gaugeService);
    MetricRegistry registry = this.context.getBean(MetricRegistry.class);
    @SuppressWarnings("unchecked") Gauge<Double> gauge = (Gauge<Double>) registry.getMetrics().get("gauge.foo");
    assertThat(gauge.getValue()).isEqualTo(new Double(2.7));
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) BufferGaugeService(org.springframework.boot.actuate.metrics.buffer.BufferGaugeService) GaugeService(org.springframework.boot.actuate.metrics.GaugeService) MetricRegistry(com.codahale.metrics.MetricRegistry) AopAutoConfiguration(org.springframework.boot.autoconfigure.aop.AopAutoConfiguration) DropwizardMetricServices(org.springframework.boot.actuate.metrics.dropwizard.DropwizardMetricServices) Gauge(com.codahale.metrics.Gauge) Test(org.junit.Test)

Aggregations

MetricRegistry (com.codahale.metrics.MetricRegistry)505 Test (org.junit.Test)177 Before (org.junit.Before)61 Test (org.junit.jupiter.api.Test)45 VerifiableProperties (com.github.ambry.config.VerifiableProperties)42 ArrayList (java.util.ArrayList)33 Counter (com.codahale.metrics.Counter)30 File (java.io.File)29 Properties (java.util.Properties)28 List (java.util.List)23 Metric (com.codahale.metrics.Metric)22 Map (java.util.Map)22 IOException (java.io.IOException)21 HashMap (java.util.HashMap)20 Size (com.github.joschi.jadconfig.util.Size)17 CountDownLatch (java.util.concurrent.CountDownLatch)17 TimeUnit (java.util.concurrent.TimeUnit)17 Timer (com.codahale.metrics.Timer)15 DefaultTaggedMetricRegistry (com.palantir.tritium.metrics.registry.DefaultTaggedMetricRegistry)15 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)15