MetricsConfig extends MapConfig { public int getMetricsSnapshotReporterInterval(String name) { return getInt(String.format(METRICS_SNAPSHOT_REPORTER_INTERVAL, name), DEFAULT_METRICS_SNAPSHOT_REPORTER_INTERVAL); } 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 testGetMetricsSnapshotReporterInterval() { String metricsReporterName = "metricReporterName"; String value = "10"; Config config = new MapConfig( ImmutableMap.of(String.format(MetricsConfig.METRICS_SNAPSHOT_REPORTER_INTERVAL, metricsReporterName), value)); assertEquals(10, new MetricsConfig(config).getMetricsSnapshotReporterInterval(metricsReporterName)); assertEquals(MetricsConfig.DEFAULT_METRICS_SNAPSHOT_REPORTER_INTERVAL, new MetricsConfig(new MapConfig()).getMetricsSnapshotReporterInterval("someName")); }