Search in sources :

Example 26 with AbstractID

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();
}
Also used : Configuration(org.apache.flink.configuration.Configuration) MetricRegistryConfiguration(org.apache.flink.runtime.metrics.MetricRegistryConfiguration) AbstractID(org.apache.flink.util.AbstractID) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 27 with AbstractID

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();
}
Also used : MetricRegistry(org.apache.flink.runtime.metrics.MetricRegistry) AbstractID(org.apache.flink.util.AbstractID) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Aggregations

AbstractID (org.apache.flink.util.AbstractID)27 Test (org.junit.Test)19 JobID (org.apache.flink.api.common.JobID)18 MetricRegistry (org.apache.flink.runtime.metrics.MetricRegistry)13 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)7 Configuration (org.apache.flink.configuration.Configuration)5 MetricRegistryConfiguration (org.apache.flink.runtime.metrics.MetricRegistryConfiguration)5 SlotSharingGroup (org.apache.flink.runtime.jobmanager.scheduler.SlotSharingGroup)4 ArrayList (java.util.ArrayList)3 LinkedHashMap (java.util.LinkedHashMap)3 List (java.util.List)3 Map (java.util.Map)3 JobExecutionResult (org.apache.flink.api.common.JobExecutionResult)3 ResourceID (org.apache.flink.runtime.clusterframework.types.ResourceID)3 QueryScopeInfo (org.apache.flink.runtime.metrics.dump.QueryScopeInfo)3 DummyCharacterFilter (org.apache.flink.runtime.metrics.util.DummyCharacterFilter)3 IOException (java.io.IOException)2 Counter (org.apache.flink.metrics.Counter)2 SimpleCounter (org.apache.flink.metrics.SimpleCounter)2 MetricReporter (org.apache.flink.metrics.reporter.MetricReporter)2