### Question:
MqMetricReporter 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) { if (!Util.isEmpty(mqContext.getMetricUrl())) { final long timestamp = System.currentTimeMillis(); final Set<Metric> metrics = new HashSet<>(); for (Map.Entry<String, Gauge> entry : gauges.entrySet()) { metrics.addAll(buildGauge(entry.getKey(), entry.getValue(), timestamp, tags)); } for (Map.Entry<String, Counter> entry : counters.entrySet()) { metrics.addAll(buildCounter(entry.getKey(), entry.getValue(), timestamp, tags)); } for (Map.Entry<String, Histogram> entry : histograms.entrySet()) { metrics.addAll(buildHistograms(entry.getKey(), entry.getValue(), timestamp, tags)); } for (Map.Entry<String, Meter> entry : meters.entrySet()) { metrics.addAll(buildMeters(entry.getKey(), entry.getValue(), timestamp, tags)); } for (Map.Entry<String, Timer> entry : timers.entrySet()) { metrics.addAll(buildTimers(entry.getKey(), entry.getValue(), timestamp, tags)); } try { if (!Util.isEmpty(mqContext.getMetricUrl()) && metrics.size() > 0) { httpClient.post(mqContext.getMetricUrl(), metrics); } } catch (Exception e) { e.printStackTrace(); } } } MqMetricReporter(MetricRegistry registry, String name, MetricFilter filter, TimeUnit rateUnit,
			TimeUnit durationUnit, Map<String, String> tags, MqContext mqContext); @Override void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters,
			SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers);  }### Answer:
@Test public void testReport() { @SuppressWarnings("resource") MqMetricReporter reporter = new MqMetricReporter(MetricSingleton.getMetricRegistry(), "mq-client", MetricFilter.ALL, TimeUnit.MILLISECONDS, TimeUnit.MILLISECONDS, null, new MqContext()); reporter.report(MetricSingleton.getMetricRegistry().getGauges(null), MetricSingleton.getMetricRegistry().getCounters(null), MetricSingleton.getMetricRegistry().getHistograms(null), MetricSingleton.getMetricRegistry().getMeters(null), MetricSingleton.getMetricRegistry().getTimers(null)); }