use of org.apache.flink.runtime.metrics.util.TestReporter in project flink by apache.
the class MetricRegistryImplTest method testConfigurableDelimiterForReporters.
@Test
public void testConfigurableDelimiterForReporters() throws Exception {
MetricConfig config1 = new MetricConfig();
config1.setProperty(ConfigConstants.METRICS_REPORTER_SCOPE_DELIMITER, "_");
MetricConfig config2 = new MetricConfig();
config2.setProperty(ConfigConstants.METRICS_REPORTER_SCOPE_DELIMITER, "-");
MetricConfig config3 = new MetricConfig();
config3.setProperty(ConfigConstants.METRICS_REPORTER_SCOPE_DELIMITER, "AA");
MetricRegistryImpl registry = new MetricRegistryImpl(MetricRegistryTestUtils.defaultMetricRegistryConfiguration(), Arrays.asList(ReporterSetup.forReporter("test1", config1, new TestReporter()), ReporterSetup.forReporter("test2", config2, new TestReporter()), ReporterSetup.forReporter("test3", config3, new TestReporter())));
assertEquals(GLOBAL_DEFAULT_DELIMITER, registry.getDelimiter());
assertEquals('_', registry.getDelimiter(0));
assertEquals('-', registry.getDelimiter(1));
assertEquals(GLOBAL_DEFAULT_DELIMITER, registry.getDelimiter(2));
assertEquals(GLOBAL_DEFAULT_DELIMITER, registry.getDelimiter(3));
assertEquals(GLOBAL_DEFAULT_DELIMITER, registry.getDelimiter(-1));
registry.shutdown().get();
}
Aggregations