Search in sources :

Example 36 with Histogram

use of com.codahale.metrics.Histogram in project helios by spotify.

the class FastForwardReporterTest method testHistogram.

@Test
public void testHistogram() throws Exception {
    final Histogram h = metricRegistry.histogram("histo.gram");
    IntStream.range(1, 10).forEach(h::update);
    reporter.reportOnce();
    verifyHistogramStats("histo.gram", "histogram");
}
Also used : Histogram(com.codahale.metrics.Histogram) Test(org.junit.Test)

Example 37 with Histogram

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

the class DropwizardMetricServices method submitHistogram.

private void submitHistogram(String name, double value) {
    long longValue = (long) value;
    Histogram metric = register(name, new HistogramMetricRegistrar());
    metric.update(longValue);
}
Also used : Histogram(com.codahale.metrics.Histogram)

Example 38 with Histogram

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

the class CompositeStatsTest method histogram.

@Test
public void histogram() throws Exception {
    Histogram histo = registry.histogram("test");
    CompositeStats histoStats = new CompositeStats(new AtomicLong(), histo);
    histoStats.update(100);
    assertEquals(1, histo.getCount());
    assertEquals(100, histo.getSnapshot().getMax());
    assertFalse(histoStats.isMeter());
    assertFalse(histoStats.isTimer());
    assertFalse(histoStats.isCounter());
    assertTrue(histoStats.isHistogram());
    assertNotNull(histoStats.getHistogram());
}
Also used : Histogram(com.codahale.metrics.Histogram) AtomicLong(java.util.concurrent.atomic.AtomicLong) Test(org.junit.Test)

Example 39 with Histogram

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

the class MetricImplTest method histogram.

@Test
public void histogram() throws Exception {
    Histogram histo = registry.histogram("test");
    HistogramImpl histoStats = new HistogramImpl(histo);
    histoStats.update(100);
    assertEquals(1, histo.getCount());
    assertEquals(100, histo.getSnapshot().getMax());
}
Also used : Histogram(com.codahale.metrics.Histogram) Test(org.junit.Test)

Example 40 with Histogram

use of com.codahale.metrics.Histogram in project lucene-solr by apache.

the class MetricUtils method convertMetric.

/**
   * Convert a single instance of metric into a map or flattened object.
   * @param n metric name
   * @param metric metric instance
   * @param propertyFilter limit what properties of a metric are returned
   * @param skipHistograms discard any {@link Histogram}-s and histogram parts of {@link Timer}-s.
   * @param skipAggregateValues discard internal values of {@link AggregateMetric}-s.
   * @param compact use compact representation for counters and gauges.
   * @param simple use simplified representation for complex metrics - instead of a (name, map)
   *             only the selected (name "." key, value) pairs will be produced.
   * @param consumer consumer that accepts produced objects
   */
static void convertMetric(String n, Metric metric, PropertyFilter propertyFilter, boolean skipHistograms, boolean skipAggregateValues, boolean compact, boolean simple, BiConsumer<String, Object> consumer) {
    if (metric instanceof Counter) {
        Counter counter = (Counter) metric;
        convertCounter(n, counter, propertyFilter, compact, consumer);
    } else if (metric instanceof Gauge) {
        Gauge gauge = (Gauge) metric;
        try {
            convertGauge(n, gauge, propertyFilter, simple, compact, consumer);
        } catch (InternalError ie) {
            if (n.startsWith("memory.") && ie.getMessage().contains("Memory Pool not found")) {
                LOG.warn("Error converting gauge '" + n + "', possible JDK bug: SOLR-10362", ie);
                consumer.accept(n, null);
            } else {
                throw ie;
            }
        }
    } else if (metric instanceof Meter) {
        Meter meter = (Meter) metric;
        convertMeter(n, meter, propertyFilter, simple, consumer);
    } else if (metric instanceof Timer) {
        Timer timer = (Timer) metric;
        convertTimer(n, timer, propertyFilter, skipHistograms, simple, consumer);
    } else if (metric instanceof Histogram) {
        if (!skipHistograms) {
            Histogram histogram = (Histogram) metric;
            convertHistogram(n, histogram, propertyFilter, simple, consumer);
        }
    } else if (metric instanceof AggregateMetric) {
        convertAggregateMetric(n, (AggregateMetric) metric, propertyFilter, skipAggregateValues, simple, consumer);
    }
}
Also used : Histogram(com.codahale.metrics.Histogram) Counter(com.codahale.metrics.Counter) Timer(com.codahale.metrics.Timer) Meter(com.codahale.metrics.Meter) AggregateMetric(org.apache.solr.metrics.AggregateMetric) Gauge(com.codahale.metrics.Gauge)

Aggregations

Histogram (com.codahale.metrics.Histogram)44 Test (org.junit.Test)21 Timer (com.codahale.metrics.Timer)17 Meter (com.codahale.metrics.Meter)13 Counter (com.codahale.metrics.Counter)12 Snapshot (com.codahale.metrics.Snapshot)11 MetricRegistry (com.codahale.metrics.MetricRegistry)8 Gauge (com.codahale.metrics.Gauge)7 UsingDataSet (com.lordofthejars.nosqlunit.annotation.UsingDataSet)5 ZonedDateTime (java.time.ZonedDateTime)5 Map (java.util.Map)5 DateTime (org.joda.time.DateTime)5 Metric (com.codahale.metrics.Metric)4 UniformReservoir (com.codahale.metrics.UniformReservoir)3 SortedMap (java.util.SortedMap)3 AggregateMetric (org.apache.solr.metrics.AggregateMetric)3 MetricSnapshot (backtype.storm.generated.MetricSnapshot)2 JAverageSnapshot (com.alibaba.jstorm.common.metric.codahale.JAverageSnapshot)2 ConsoleReporter (com.codahale.metrics.ConsoleReporter)2 MetricFilter (com.codahale.metrics.MetricFilter)2