use of org.apache.flink.util.AbstractID in project flink by apache.
the class TaskMetricGroupTest method testTaskMetricGroupCleanup.
@Test
public void testTaskMetricGroupCleanup() {
CountingMetricRegistry registry = new CountingMetricRegistry(new Configuration());
TaskManagerMetricGroup taskManagerMetricGroup = new TaskManagerMetricGroup(registry, "localhost", "0");
TaskManagerJobMetricGroup taskManagerJobMetricGroup = new TaskManagerJobMetricGroup(registry, taskManagerMetricGroup, new JobID(), "job");
TaskMetricGroup taskMetricGroup = new TaskMetricGroup(registry, taskManagerJobMetricGroup, new AbstractID(), new AbstractID(), "task", 0, 0);
// the io metric should have registered predefined metrics
assertTrue(registry.getNumberRegisteredMetrics() > 0);
taskMetricGroup.close();
// now alle registered metrics should have been unregistered
assertEquals(0, registry.getNumberRegisteredMetrics());
registry.shutdown();
}
use of org.apache.flink.util.AbstractID in project flink by apache.
the class TaskMetricGroupTest method testGenerateScopeDefault.
// ------------------------------------------------------------------------
// scope tests
// -----------------------------------------------------------------------
@Test
public void testGenerateScopeDefault() {
MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
AbstractID vertexId = new AbstractID();
AbstractID executionId = new AbstractID();
TaskManagerMetricGroup tmGroup = new TaskManagerMetricGroup(registry, "theHostName", "test-tm-id");
TaskManagerJobMetricGroup jmGroup = new TaskManagerJobMetricGroup(registry, tmGroup, new JobID(), "myJobName");
TaskMetricGroup taskGroup = new TaskMetricGroup(registry, jmGroup, vertexId, executionId, "aTaskName", 13, 2);
assertArrayEquals(new String[] { "theHostName", "taskmanager", "test-tm-id", "myJobName", "aTaskName", "13" }, taskGroup.getScopeComponents());
assertEquals("theHostName.taskmanager.test-tm-id.myJobName.aTaskName.13.name", taskGroup.getMetricIdentifier("name"));
registry.shutdown();
}
Aggregations