@Test public void testReportMetricWithWhitelist() { when(customMetricsConfig.metricQuantiles()).thenReturn(true); when(customMetricsConfig.getMetrics()).thenReturn(Arrays.asList(METRIC_NAME)); registry.meter(METRIC_NAME); reporter = new CustomMetricsReporter(registry, client, customMetricsConfig); reporter.report(); checkMetricsAreSent(5, "meter", METRIC_NAME); }
@Override public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { try { List<Metric> convertedMetrics = convert(gauges, counters, histograms, meters, timers); if (convertedMetrics.isEmpty()) { LOGGER.debug("No metrics for sending."); return; } sendMetrics(convertedMetrics); } catch (Exception e) { LOGGER.error("Unable to send metrics.", e); } }
CustomMetricsReporter extends ScheduledReporter { @Override public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { try { List<Metric> convertedMetrics = convert(gauges, counters, histograms, meters, timers); if (convertedMetrics.isEmpty()) { LOGGER.debug("No metrics for sending."); return; } sendMetrics(convertedMetrics); } catch (Exception e) { LOGGER.error("Unable to send metrics.", e); } } }
CustomMetricsReporter extends ScheduledReporter { @Override public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { try { List<Metric> convertedMetrics = convert(gauges, counters, histograms, meters, timers); if (convertedMetrics.isEmpty()) { LOGGER.debug("No metrics for sending."); return; } sendMetrics(convertedMetrics); } catch (Exception e) { LOGGER.error("Unable to send metrics.", e); } } CustomMetricsReporter(MetricRegistry registry, MonitoringClient client,
                                 CustomMetricsConfiguration customMetricsConfig); }
CustomMetricsReporter extends ScheduledReporter { @Override public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { try { List<Metric> convertedMetrics = convert(gauges, counters, histograms, meters, timers); if (convertedMetrics.isEmpty()) { LOGGER.debug("No metrics for sending."); return; } sendMetrics(convertedMetrics); } catch (Exception e) { LOGGER.error("Unable to send metrics.", e); } } CustomMetricsReporter(MetricRegistry registry, MonitoringClient client,
                                 CustomMetricsConfiguration customMetricsConfig); @Override void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters,
                       SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters,
                       SortedMap<String, Timer> timers); }
CustomMetricsReporter extends ScheduledReporter { @Override public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { try { List<Metric> convertedMetrics = convert(gauges, counters, histograms, meters, timers); if (convertedMetrics.isEmpty()) { LOGGER.debug("No metrics for sending."); return; } sendMetrics(convertedMetrics); } catch (Exception e) { LOGGER.error("Unable to send metrics.", e); } } CustomMetricsReporter(MetricRegistry registry, MonitoringClient client,
                                 CustomMetricsConfiguration customMetricsConfig); @Override void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters,
                       SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters,
                       SortedMap<String, Timer> timers);  }