Source:
public void onStart(StartEvent event) throws Exception { config.getJmx().ifPresent(jmx -> { if (jmx.isEnabled()) { injector.getInstance(JmxReporter.class).start(); } }); config.getConsole().ifPresent(console -> { if (console.isEnabled()) { injector.getInstance(ConsoleReporter.class).start(console.getReporterInterval().getSeconds(), SECONDS); } }); config.getSlf4j().ifPresent(slf4j -> { if (slf4j.isEnabled()) { injector.getInstance(Slf4jReporter.class).start(slf4j.getReporterInterval().getSeconds(), SECONDS); } }); config.getCsv().ifPresent(csv -> { if (csv.isEnabled()) { injector.getInstance(CsvReporter.class).start(csv.getReporterInterval().getSeconds(), SECONDS); } }); config.getGraphite().ifPresent(graphite -> { if (graphite.isEnabled()) { injector.getInstance(GraphiteReporter.class).start(graphite.getReporterInterval().getSeconds(), SECONDS); } }); if (config.isJvmMetrics()) { final MetricRegistry metricRegistry = injector.getInstance(MetricRegistry.class); metricRegistry.registerAll(new GarbageCollectorMetricSet()); metricRegistry.registerAll(new ThreadStatesGaugeSet()); metricRegistry.registerAll(new MemoryUsageGaugeSet()); } if (config.isByteBufAllocatorMetrics()) { final MetricRegistry metricRegistry = injector.getInstance(MetricRegistry.class); metricRegistry.registerAll( new PooledByteBufAllocatorMetricSet( PooledByteBufAllocator.DEFAULT, config.isDetailedByteBufAllocatorMetrics() ) ); } }

Target:
public void onStart(StartEvent event) throws Exception { config.getJmx().ifPresent(jmx -> { if (jmx.isEnabled()) { injector.getInstance(JmxReporter.class).start(); } }); config.getConsole().ifPresent(console -> { if (console.isEnabled()) { injector.getInstance(ConsoleReporter.class).start(console.getReporterInterval().getSeconds(), SECONDS); } }); config.getSlf4j().ifPresent(slf4j -> { if (slf4j.isEnabled()) { injector.getInstance(Slf4jReporter.class).start(slf4j.getReporterInterval().getSeconds(), SECONDS); } }); config.getCsv().ifPresent(csv -> { if (csv.isEnabled()) { injector.getInstance(CsvReporter.class).start(csv.getReporterInterval().getSeconds(), SECONDS); } }); config.getGraphite().ifPresent(graphite -> { if (graphite.isEnabled()) { injector.getInstance(GraphiteReporter.class).start(graphite.getReporterInterval().getSeconds(), SECONDS); } }); if (config.isJvmMetrics()) { final MetricRegistry metricRegistry = injector.getInstance(MetricRegistry.class); metricRegistry.registerAll(new GarbageCollectorMetricSet()); metricRegistry.registerAll(new ThreadStatesGaugeSet()); metricRegistry.registerAll(new MemoryUsageGaugeSet()); } config.getByteBufAllocator().ifPresent(byteBufAllocatorConfig -> { if (byteBufAllocatorConfig.isEnabled()) { final MetricRegistry metricRegistry = injector.getInstance(MetricRegistry.class); final ByteBufAllocator byteBufAllocator = event.getRegistry().get(ByteBufAllocator.class); final MetricSet metricSet; if (byteBufAllocator instanceof PooledByteBufAllocator) { metricSet = new PooledByteBufAllocatorMetricSet((PooledByteBufAllocator) byteBufAllocator, byteBufAllocatorConfig.isDetailed()); } else if (byteBufAllocator instanceof UnpooledByteBufAllocator) { metricSet = new UnpooledByteBufAllocatorMetricSet((UnpooledByteBufAllocator) byteBufAllocator); } else { throw new UnsupportedOperationException(String.format("Unknown type of byte buf allocator (%s)", byteBufAllocator.getClass())); } metricRegistry.registerAll(metricSet); } }); }