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");
}
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);
}
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());
}
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());
}
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);
}
}
Aggregations