@Test @SuppressWarnings("unchecked") public void codahaleMetricsEngine_gracefully_handles_null_reporters_list() { CodahaleMetricsCollector cmc = new CodahaleMetricsCollector(); CodahaleMetricsEngine engine = appGuiceModule.codahaleMetricsEngine(cmc, null, false); assertThat((Collection<ReporterFactory>) TestUtils.Whitebox.getInternalState(engine, "reporters")).isEmpty(); assertThat(TestUtils.Whitebox.getInternalState(engine, "started")).isEqualTo(true); }
@Provides @Singleton public CodahaleMetricsEngine codahaleMetricsEngine(@Nullable CodahaleMetricsCollector cmc, @Nullable List<ReporterFactory> reporters, @Named("metrics.reportJvmMetrics") boolean reportJvmMetrics) { if (cmc == null) { return null; } if (reporters == null) { reporters = Collections.emptyList(); } CodahaleMetricsEngine engine = new CodahaleMetricsEngine(cmc, reporters); if (reportJvmMetrics) { engine.reportJvmMetrics(); } engine.start(); return engine; }
AppMetricsGuiceModule extends AbstractModule { @Provides @Singleton public CodahaleMetricsEngine codahaleMetricsEngine(@Nullable CodahaleMetricsCollector cmc, @Nullable List<ReporterFactory> reporters, @Named("metrics.reportJvmMetrics") boolean reportJvmMetrics) { if (cmc == null) { return null; } if (reporters == null) { reporters = Collections.emptyList(); } CodahaleMetricsEngine engine = new CodahaleMetricsEngine(cmc, reporters); if (reportJvmMetrics) { engine.reportJvmMetrics(); } engine.start(); return engine; } }
AppMetricsGuiceModule extends AbstractModule { @Provides @Singleton public CodahaleMetricsEngine codahaleMetricsEngine(@Nullable CodahaleMetricsCollector cmc, @Nullable List<ReporterFactory> reporters, @Named("metrics.reportJvmMetrics") boolean reportJvmMetrics) { if (cmc == null) { return null; } if (reporters == null) { reporters = Collections.emptyList(); } CodahaleMetricsEngine engine = new CodahaleMetricsEngine(cmc, reporters); if (reportJvmMetrics) { engine.reportJvmMetrics(); } engine.start(); return engine; }  }
AppMetricsGuiceModule extends AbstractModule { @Provides @Singleton public CodahaleMetricsEngine codahaleMetricsEngine(@Nullable CodahaleMetricsCollector cmc, @Nullable List<ReporterFactory> reporters, @Named("metrics.reportJvmMetrics") boolean reportJvmMetrics) { if (cmc == null) { return null; } if (reporters == null) { reporters = Collections.emptyList(); } CodahaleMetricsEngine engine = new CodahaleMetricsEngine(cmc, reporters); if (reportJvmMetrics) { engine.reportJvmMetrics(); } engine.start(); return engine; }  @Provides @Singleton CodahaleMetricsCollector codahaleMetricsCollector(@Nullable List<ReporterFactory> reporters); @Provides @Singleton List<ReporterFactory> metricsReporters(
        @Named("metrics.slf4j.reporting.enabled") boolean slf4jReportingEnabled,
        @Named("metrics.jmx.reporting.enabled") boolean jmxReportingEnabled,
        @Named("metrics.graphite.url") String graphiteUrl,
        @Named("metrics.graphite.port") int graphitePort,
        @Named("metrics.graphite.reporting.enabled") boolean graphiteEnabled,
        @Named("appInfoFuture") CompletableFuture<AppInfo> appInfoFuture
    ); @Provides @Singleton CodahaleMetricsEngine codahaleMetricsEngine(@Nullable CodahaleMetricsCollector cmc,
                                                       @Nullable List<ReporterFactory> reporters,
                                                       @Named("metrics.reportJvmMetrics") boolean reportJvmMetrics); @Provides @Singleton CodahaleMetricsListener metricsListener(@Nullable CodahaleMetricsCollector metricsCollector,
                                                   @Nullable CodahaleMetricsEngine engine); }
AppMetricsGuiceModule extends AbstractModule { @Provides @Singleton public CodahaleMetricsEngine codahaleMetricsEngine(@Nullable CodahaleMetricsCollector cmc, @Nullable List<ReporterFactory> reporters, @Named("metrics.reportJvmMetrics") boolean reportJvmMetrics) { if (cmc == null) { return null; } if (reporters == null) { reporters = Collections.emptyList(); } CodahaleMetricsEngine engine = new CodahaleMetricsEngine(cmc, reporters); if (reportJvmMetrics) { engine.reportJvmMetrics(); } engine.start(); return engine; }  @Provides @Singleton CodahaleMetricsCollector codahaleMetricsCollector(@Nullable List<ReporterFactory> reporters); @Provides @Singleton List<ReporterFactory> metricsReporters(
        @Named("metrics.slf4j.reporting.enabled") boolean slf4jReportingEnabled,
        @Named("metrics.jmx.reporting.enabled") boolean jmxReportingEnabled,
        @Named("metrics.graphite.url") String graphiteUrl,
        @Named("metrics.graphite.port") int graphitePort,
        @Named("metrics.graphite.reporting.enabled") boolean graphiteEnabled,
        @Named("appInfoFuture") CompletableFuture<AppInfo> appInfoFuture
    ); @Provides @Singleton CodahaleMetricsEngine codahaleMetricsEngine(@Nullable CodahaleMetricsCollector cmc,
                                                       @Nullable List<ReporterFactory> reporters,
                                                       @Named("metrics.reportJvmMetrics") boolean reportJvmMetrics); @Provides @Singleton CodahaleMetricsListener metricsListener(@Nullable CodahaleMetricsCollector metricsCollector,
                                                   @Nullable CodahaleMetricsEngine engine);  }