@Test public void reportsCounterValues() throws Exception { reporter.reportMetrics(map(), map(name("test.counter").build(), counter(100L)).add(name("test.counter2").build(), counter(200L)), map(), map(), map()); verify(logger).info("Metrics ========================================================================\n" + "\n" + "-- Counters --------------------------------------------------------------------\n" + "name | count\n" + "test.counter2 | 200\n" + " test.counter | 100\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);  }