use of org.apache.flink.runtime.metrics.MetricRegistryImpl in project flink by apache.
the class AbstractMetricGroupTest method testScopeGenerationWithoutReporters.
@Test
public void testScopeGenerationWithoutReporters() throws Exception {
Configuration config = new Configuration();
config.setString(MetricOptions.SCOPE_NAMING_TM, "A.B.C.D");
MetricRegistryImpl testRegistry = new MetricRegistryImpl(MetricRegistryTestUtils.fromConfiguration(config));
try {
TaskManagerMetricGroup group = TaskManagerMetricGroup.createTaskManagerMetricGroup(testRegistry, "host", new ResourceID("id"));
assertEquals("MetricReporters list should be empty", 0, testRegistry.getReporters().size());
// default delimiter should be used
assertEquals("A.B.X.D.1", group.getMetricIdentifier("1", FILTER_C));
// no caching should occur
assertEquals("A.X.C.D.1", group.getMetricIdentifier("1", FILTER_B));
// invalid reporter indices do not throw errors
assertEquals("A.X.C.D.1", group.getMetricIdentifier("1", FILTER_B, -1, '.'));
assertEquals("A.X.C.D.1", group.getMetricIdentifier("1", FILTER_B, 2, '.'));
} finally {
testRegistry.shutdown().get();
}
}
use of org.apache.flink.runtime.metrics.MetricRegistryImpl in project flink by apache.
the class JobManagerJobGroupTest method testGenerateScopeDefault.
@Test
public void testGenerateScopeDefault() throws Exception {
MetricRegistryImpl registry = new MetricRegistryImpl(MetricRegistryTestUtils.defaultMetricRegistryConfiguration());
JobManagerJobMetricGroup jmGroup = JobManagerMetricGroup.createJobManagerMetricGroup(registry, "theHostName").addJob(new JobID(), "myJobName");
assertArrayEquals(new String[] { "theHostName", "jobmanager", "myJobName" }, jmGroup.getScopeComponents());
assertEquals("theHostName.jobmanager.myJobName.name", jmGroup.getMetricIdentifier("name"));
registry.shutdown().get();
}
use of org.apache.flink.runtime.metrics.MetricRegistryImpl in project flink by apache.
the class JobManagerJobGroupTest method testCreateQueryServiceMetricInfo.
@Test
public void testCreateQueryServiceMetricInfo() {
JobID jid = new JobID();
MetricRegistryImpl registry = new MetricRegistryImpl(MetricRegistryTestUtils.defaultMetricRegistryConfiguration());
JobManagerJobMetricGroup jmj = JobManagerMetricGroup.createJobManagerMetricGroup(registry, "theHostName").addJob(jid, "myJobName");
QueryScopeInfo.JobQueryScopeInfo info = jmj.createQueryServiceMetricInfo(new DummyCharacterFilter());
assertEquals("", info.scope);
assertEquals(jid.toString(), info.jobID);
}
use of org.apache.flink.runtime.metrics.MetricRegistryImpl in project flink by apache.
the class JobManagerJobGroupTest method testGenerateScopeCustom.
@Test
public void testGenerateScopeCustom() throws Exception {
Configuration cfg = new Configuration();
cfg.setString(MetricOptions.SCOPE_NAMING_JM, "abc");
cfg.setString(MetricOptions.SCOPE_NAMING_JM_JOB, "some-constant.<job_name>");
MetricRegistryImpl registry = new MetricRegistryImpl(MetricRegistryTestUtils.fromConfiguration(cfg));
JobManagerJobMetricGroup jmGroup = JobManagerMetricGroup.createJobManagerMetricGroup(registry, "theHostName").addJob(new JobID(), "myJobName");
assertArrayEquals(new String[] { "some-constant", "myJobName" }, jmGroup.getScopeComponents());
assertEquals("some-constant.myJobName.name", jmGroup.getMetricIdentifier("name"));
registry.shutdown().get();
}
use of org.apache.flink.runtime.metrics.MetricRegistryImpl in project flink by apache.
the class JobManagerJobGroupTest method testGenerateScopeCustomWildcard.
@Test
public void testGenerateScopeCustomWildcard() throws Exception {
Configuration cfg = new Configuration();
cfg.setString(MetricOptions.SCOPE_NAMING_JM, "peter");
cfg.setString(MetricOptions.SCOPE_NAMING_JM_JOB, "*.some-constant.<job_id>");
MetricRegistryImpl registry = new MetricRegistryImpl(MetricRegistryTestUtils.fromConfiguration(cfg));
JobID jid = new JobID();
JobManagerJobMetricGroup jmGroup = JobManagerMetricGroup.createJobManagerMetricGroup(registry, "theHostName").addJob(jid, "myJobName");
assertArrayEquals(new String[] { "peter", "some-constant", jid.toString() }, jmGroup.getScopeComponents());
assertEquals("peter.some-constant." + jid + ".name", jmGroup.getMetricIdentifier("name"));
registry.shutdown().get();
}
Aggregations