/** * Returns a map of all the histograms in the registry and their names. * * @return all the histograms in the registry */ public SortedMap<String, Histogram> getHistograms() { return getHistograms(MetricFilter.ALL); }
private static void assertHistogram(String property, int expectedCount) { assertSummary(dropwizardRegistry.getHistograms(), property, expectedCount); }
@Override public void report() { // we do not need to lock here, because the dropwizard registry is // internally a concurrent map @SuppressWarnings("rawtypes") final SortedMap<String, com.codahale.metrics.Gauge> gauges = registry.getGauges(); final SortedMap<String, com.codahale.metrics.Counter> counters = registry.getCounters(); final SortedMap<String, com.codahale.metrics.Histogram> histograms = registry.getHistograms(); final SortedMap<String, com.codahale.metrics.Meter> meters = registry.getMeters(); final SortedMap<String, com.codahale.metrics.Timer> timers = registry.getTimers(); this.reporter.report(gauges, counters, histograms, meters, timers); }
public void reportRegistry(MetricRegistry registry) { Map<String, String> tags = Maps.newHashMap(); if (registry instanceof MetricContext) { tags = Maps.transformValues(((MetricContext) registry).getTagMap(), new Function<Object, String>() { @Override public String apply(Object input) { return input.toString(); } }); } report(registry.getGauges(this.filter), registry.getCounters(this.filter), registry.getHistograms(this.filter), registry.getMeters(this.filter), registry.getTimers(this.filter), tags); }
@VisibleForTesting void reportOnce() { // resolve the additional attributes once per report additionalAttributes = additionalAttributesSupplier.get(); if (additionalAttributes == null) { additionalAttributes = Collections.emptyMap(); } metricRegistry.getGauges().forEach(this::reportGauge); metricRegistry.getCounters().forEach(this::reportCounter); metricRegistry.getMeters().forEach(this::reportMeter); metricRegistry.getHistograms().forEach(this::reportHistogram); metricRegistry.getTimers().forEach(this::reportTimer); }
/** * Report the current values of all metrics in the registry. */ public void report() { synchronized (this) { report(registry.getGauges(filter), registry.getCounters(filter), registry.getHistograms(filter), registry.getMeters(filter), registry.getTimers(filter)); } }
metrics.put("gauges", gauges); Map<String, Object> histograms = histograms(registry.getHistograms(filter), showSamples); if (histograms.size() > 0) { metrics.put("histograms", histograms);
@Override public List<MetricFamilySamples> collect() { Map<String, MetricFamilySamples> mfSamplesMap = new HashMap<String, MetricFamilySamples>(); for (SortedMap.Entry<String, Gauge> entry : registry.getGauges().entrySet()) { addToMap(mfSamplesMap, fromGauge(entry.getKey(), entry.getValue())); } for (SortedMap.Entry<String, Counter> entry : registry.getCounters().entrySet()) { addToMap(mfSamplesMap, fromCounter(entry.getKey(), entry.getValue())); } for (SortedMap.Entry<String, Histogram> entry : registry.getHistograms().entrySet()) { addToMap(mfSamplesMap, fromHistogram(entry.getKey(), entry.getValue())); } for (SortedMap.Entry<String, Timer> entry : registry.getTimers().entrySet()) { addToMap(mfSamplesMap, fromTimer(entry.getKey(), entry.getValue())); } for (SortedMap.Entry<String, Meter> entry : registry.getMeters().entrySet()) { addToMap(mfSamplesMap, fromMeter(entry.getKey(), entry.getValue())); } return new ArrayList<MetricFamilySamples>(mfSamplesMap.values()); }
SortedMap<String, Histogram> histograms = metricRegistry.getHistograms(); if (histograms.size() > 0) { writeHistograms(histograms, writer);
/** * Returns a map of all the histograms in the registry and their names. * * @return all the histograms in the registry */ public SortedMap<String, Histogram> getHistograms() { return getHistograms(MetricFilter.ALL); }
/** * Returns a map of all the histograms in the registry and their names. * * @return all the histograms in the registry */ public SortedMap<String, Histogram> getHistograms() { return getHistograms(MetricFilter.ALL); }
@Override public Histogram getHistogram(String module, String component, String... names) { String name = getMetricName(module, component, names); Histogram histogram = metricRegistry.getHistograms().get(name); if (histogram == null) { logger.debug("Creating a Histogram: {}", name); histogram = metricRegistry.histogram(name); } return histogram; }
@RolesAllowed(AdminModule.RESTX_ADMIN_ROLE) @GET("/@/metrics") public Map metrics() { return ImmutableMap.of( "gauges", metrics.getGauges(), "timers", metrics.getTimers(), "meters", metrics.getMeters(), "counters", metrics.getCounters(), "histograms", metrics.getHistograms() ); }
/** * Builds a report for a specified registry. * @param registry The registry. * @return The report. */ public ReportProtos.EssemReport buildReport(final MetricRegistry registry) { return buildReport(registry.getGauges(), registry.getCounters(), registry.getHistograms(), registry.getMeters(), registry.getTimers()); }
@Override public void report() { // we do not need to lock here, because the dropwizard registry is // internally a concurrent map @SuppressWarnings("rawtypes") final SortedMap<String, com.codahale.metrics.Gauge> gauges = registry.getGauges(); final SortedMap<String, com.codahale.metrics.Counter> counters = registry.getCounters(); final SortedMap<String, com.codahale.metrics.Histogram> histograms = registry.getHistograms(); final SortedMap<String, com.codahale.metrics.Meter> meters = registry.getMeters(); final SortedMap<String, com.codahale.metrics.Timer> timers = registry.getTimers(); this.reporter.report(gauges, counters, histograms, meters, timers); }
/** * Report the current values of all metrics in the registry. */ public void report() { report(registry.getGauges(filter), registry.getCounters(filter), registry.getHistograms(filter), registry.getMeters(filter), registry.getTimers(filter)); }
/** * Report the current values of all metrics in the registry. */ public void report() { report(registry.getGauges(filter), registry.getCounters(filter), registry.getHistograms(filter), registry.getMeters(filter), registry.getTimers(filter)); }
/** * Report the current values of all metrics in the registry. */ public void report() { report(registry.getGauges(filter), registry.getCounters(filter), registry.getHistograms(filter), registry.getMeters(filter), registry.getTimers(filter)); }
@Test public void histogram() throws Exception { HistogramStats histoStats = statsProvider.getHistogram("test", StatsOptions.DEFAULT); assertNotNull(histoStats); assertNotNull(statsProvider.getRegistry().getHistograms().containsKey("test")); assertTrue(((CompositeStats) histoStats).isHistogram()); }
public static BsonDocument generateMetricsBson(MetricRegistry registry, TimeUnit rateUnit, TimeUnit durationUnit) { MetricsJsonGenerator generator = new MetricsJsonGenerator(rateUnit, durationUnit); return new BsonDocument() .append("version", new BsonString("3.0.0")) .append("gauges", generator.toBson(registry.getGauges(), generator::generateGauge)) .append("counters", generator.toBson(registry.getCounters(), generator::generateCounter)) .append("histograms", generator.toBson(registry.getHistograms(), generator::generateHistogram)) .append("meters", generator.toBson(registry.getMeters(), generator::generateMeter)) .append("timers", generator.toBson(registry.getTimers(), generator::generateTimer)); } private final String singularRateUnitString;