@Override public ConsoleReporter get() { ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry).build(); String interval = launchConfig.getOther("metrics.scheduledreporter.interval", "30"); reporter.start(Long.parseLong(interval), TimeUnit.SECONDS); return reporter; }
/** * Initializes the console reporter based on the current configuration. * * @param config the console reporter configuration */ private void configureConsoleReporter(ConsoleReporterConfig config) { if (config.isEnabled()) { consoleReporter = ConsoleReporter.forRegistry(metricRegistry) .convertRatesTo(config.getConvertRates()) .convertDurationsTo(config.getConvertDurations()) .build(); consoleReporter.start(config.getFrequency(), config.getFrequencyUnit()); } }
@Before public void before_reporter() { reporter.start(1, TimeUnit.SECONDS); }