@Test public void reportsHistogramValues() throws Exception { reporter.reportMetrics(map(), map(), testHistograms(), map(), map()); verify(logger).info("Metrics ========================================================================\n" + "\n" + "-- Histograms ------------------------------------------------------------------\n" + "name | count | mean | min | max | stddev | p50 | p75 | p95 | p98 | p99 | p999 |\n" + "test.histogram2 | 1 | 400.00 | 400.00 | 200.00 | 500.00 | 600.00 | 700.00 | 800.00 | 900.00 | 1,000.00 | 1,100.00 | \n" + " test.histogram | 1 | 300.00 | 400.00 | 200.00 | 500.00 | 600.00 | 700.00 | 800.00 | 900.00 | 1,000.00 | 1,100.00 | \n" + "\n" + "\n"); }
@Override public void reportMetrics(Map<MetricName, Gauge> gauges, Map<MetricName, Counter> counters, Map<MetricName, Histogram> histograms, Map<MetricName, Meter> meters, Map<MetricName, Timer> timers) { final Timer.Context time = Stagemonitor.getMetric2Registry().timer(reportingTimeMetricName).time(); StringBuilder sb = new StringBuilder(1000); printWithBanner("Metrics", '=', sb); sb.append('\n'); try { logGauges(gauges, sb); logCounters(counters, sb); logHistograms(histograms, sb); logMeters(meters, sb); logTimers(timers, sb); sb.append('\n'); } catch (Exception e) { log.error(e.getMessage(), e); } finally { log.info(sb.toString()); time.stop(); } }
SortedTableLogReporter extends ScheduledMetrics2Reporter { @Override public void reportMetrics(Map<MetricName, Gauge> gauges, Map<MetricName, Counter> counters, Map<MetricName, Histogram> histograms, Map<MetricName, Meter> meters, Map<MetricName, Timer> timers) { final Timer.Context time = Stagemonitor.getMetric2Registry().timer(reportingTimeMetricName).time(); StringBuilder sb = new StringBuilder(1000); printWithBanner("Metrics", '=', sb); sb.append('\n'); try { logGauges(gauges, sb); logCounters(counters, sb); logHistograms(histograms, sb); logMeters(meters, sb); logTimers(timers, sb); sb.append('\n'); } catch (Exception e) { log.error(e.getMessage(), e); } finally { log.info(sb.toString()); time.stop(); } } }
SortedTableLogReporter extends ScheduledMetrics2Reporter { @Override public void reportMetrics(Map<MetricName, Gauge> gauges, Map<MetricName, Counter> counters, Map<MetricName, Histogram> histograms, Map<MetricName, Meter> meters, Map<MetricName, Timer> timers) { final Timer.Context time = Stagemonitor.getMetric2Registry().timer(reportingTimeMetricName).time(); StringBuilder sb = new StringBuilder(1000); printWithBanner("Metrics", '=', sb); sb.append('\n'); try { logGauges(gauges, sb); logCounters(counters, sb); logHistograms(histograms, sb); logMeters(meters, sb); logTimers(timers, sb); sb.append('\n'); } catch (Exception e) { log.error(e.getMessage(), e); } finally { log.info(sb.toString()); time.stop(); } } private  SortedTableLogReporter(Builder builder); }
SortedTableLogReporter extends ScheduledMetrics2Reporter { @Override public void reportMetrics(Map<MetricName, Gauge> gauges, Map<MetricName, Counter> counters, Map<MetricName, Histogram> histograms, Map<MetricName, Meter> meters, Map<MetricName, Timer> timers) { final Timer.Context time = Stagemonitor.getMetric2Registry().timer(reportingTimeMetricName).time(); StringBuilder sb = new StringBuilder(1000); printWithBanner("Metrics", '=', sb); sb.append('\n'); try { logGauges(gauges, sb); logCounters(counters, sb); logHistograms(histograms, sb); logMeters(meters, sb); logTimers(timers, sb); sb.append('\n'); } catch (Exception e) { log.error(e.getMessage(), e); } finally { log.info(sb.toString()); time.stop(); } } private  SortedTableLogReporter(Builder builder); static Builder forRegistry(Metric2Registry registry); @Override void reportMetrics(Map<MetricName, Gauge> gauges,
							  Map<MetricName, Counter> counters,
							  Map<MetricName, Histogram> histograms,
							  Map<MetricName, Meter> meters,
							  Map<MetricName, Timer> timers); void printDouble(double d, StringBuilder sb); }
SortedTableLogReporter extends ScheduledMetrics2Reporter { @Override public void reportMetrics(Map<MetricName, Gauge> gauges, Map<MetricName, Counter> counters, Map<MetricName, Histogram> histograms, Map<MetricName, Meter> meters, Map<MetricName, Timer> timers) { final Timer.Context time = Stagemonitor.getMetric2Registry().timer(reportingTimeMetricName).time(); StringBuilder sb = new StringBuilder(1000); printWithBanner("Metrics", '=', sb); sb.append('\n'); try { logGauges(gauges, sb); logCounters(counters, sb); logHistograms(histograms, sb); logMeters(meters, sb); logTimers(timers, sb); sb.append('\n'); } catch (Exception e) { log.error(e.getMessage(), e); } finally { log.info(sb.toString()); time.stop(); } } private  SortedTableLogReporter(Builder builder); static Builder forRegistry(Metric2Registry registry); @Override void reportMetrics(Map<MetricName, Gauge> gauges,
							  Map<MetricName, Counter> counters,
							  Map<MetricName, Histogram> histograms,
							  Map<MetricName, Meter> meters,
							  Map<MetricName, Timer> timers); void printDouble(double d, StringBuilder sb);  }