Search in sources :

Example 1 with TestReporter

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();
}
Also used : MetricConfig(org.apache.flink.metrics.MetricConfig) TestReporter(org.apache.flink.runtime.metrics.util.TestReporter) MetricGroupTest(org.apache.flink.runtime.metrics.groups.MetricGroupTest) Test(org.junit.Test)

Aggregations

MetricConfig (org.apache.flink.metrics.MetricConfig)1 MetricGroupTest (org.apache.flink.runtime.metrics.groups.MetricGroupTest)1 TestReporter (org.apache.flink.runtime.metrics.util.TestReporter)1 Test (org.junit.Test)1