SiddhiStreamReporter 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) { final long timestamp = TimeUnit.MILLISECONDS.toSeconds(clock.getTime()); for (Map.Entry<String, Gauge> entry : gauges.entrySet()) { reportGauge(timestamp, entry.getKey(), entry.getValue()); } for (Map.Entry<String, Counter> entry : counters.entrySet()) { reportCounter(timestamp, entry.getKey(), entry.getValue()); } for (Map.Entry<String, Histogram> entry : histograms.entrySet()) { reportHistogram(timestamp, entry.getKey(), entry.getValue()); } for (Map.Entry<String, Meter> entry : meters.entrySet()) { reportMeter(timestamp, entry.getKey(), entry.getValue()); } for (Map.Entry<String, Timer> entry : timers.entrySet()) { reportTimer(timestamp, entry.getKey(), entry.getValue()); } } private  SiddhiStreamReporter(MetricRegistry registry,
                                 StreamOperationServiceWithoutMetrics streamOperationService,
                                 TimeUnit rateUnit,
                                 TimeUnit durationUnit,
                                 Clock clock,
                                 MetricFilter filter); @Override void report(SortedMap<String, Gauge> gauges,
                       SortedMap<String, Counter> counters,
                       SortedMap<String, Histogram> histograms,
                       SortedMap<String, Meter> meters,
                       SortedMap<String, Timer> timers); static Builder forRegistry(MetricRegistry registry, StreamOperationServiceWithoutMetrics streamOperationService);  }
@Test public void testReport() throws Exception { Clock clock= Clock.defaultClock(); reporter= builder.convertRatesTo(TimeUnit.MINUTES) .convertDurationsTo(TimeUnit.SECONDS) .withClock(clock) .filter(MetricFilter.ALL) .build(); reporter.start(1, TimeUnit.SECONDS); SortedMap<String, Gauge> gauges= new TreeMap<>(); SortedMap<String, Counter> counters= new TreeMap<>(); SortedMap<String, Histogram> histograms= new TreeMap<>(); SortedMap<String, Meter> meters= new TreeMap<>(); SortedMap<String, Timer> timers= new TreeMap<>(); Gauge gauge= new FileDescriptorRatioGauge(); gauges.put("gauges", gauge); Counter counter= new Counter(); counters.put("counters", counter); Meter meter= new Meter(); meters.put("meters", meter); Timer timer= new Timer(); timers.put("timers", timer); Exception ex= null; try { reporter.report(gauges, counters, histograms, meters, timers); } catch (Exception e) {ex= e; } assertNull("Expected null value that means not exception", ex); }