MetricsConfig extends MapConfig { public boolean getMetricsTimerEnabled() { return getBoolean(METRICS_TIMER_ENABLED, true); } MetricsConfig(Config config); Optional<String> getMetricsFactoryClass(String name); Optional<String> getMetricsSnapshotReporterStream(String name); int getMetricsSnapshotReporterInterval(String name); Optional<String> getMetricsSnapshotReporterBlacklist(String name); List<String> getMetricReporterNames(); boolean getMetricsTimerEnabled(); boolean getMetricsTimerDebugEnabled(); static final String METRICS_REPORTERS; static final String METRICS_REPORTER_FACTORY; static final String METRICS_TIMER_ENABLED; static final String METRICS_TIMER_DEBUG_ENABLED; static final String METRICS_SNAPSHOT_REPORTER_STREAM; static final String METRICS_SNAPSHOT_REPORTER_INTERVAL; static final String METRICS_SNAPSHOT_REPORTER_BLACKLIST; static final String METRICS_SNAPSHOT_REPORTER_NAME_FOR_DIAGNOSTICS; }
@Test public void testGetMetricsTimerEnabled() { Config config = new MapConfig(ImmutableMap.of(MetricsConfig.METRICS_TIMER_ENABLED, "true")); assertTrue(new MetricsConfig(config).getMetricsTimerEnabled()); config = new MapConfig(ImmutableMap.of(MetricsConfig.METRICS_TIMER_ENABLED, "false")); assertFalse(new MetricsConfig(config).getMetricsTimerEnabled()); assertTrue(new MetricsConfig(new MapConfig()).getMetricsTimerEnabled()); }