Search in sources :

Example 36 with MetricRegistry

use of org.apache.flink.runtime.metrics.MetricRegistry in project flink by apache.

the class TaskManagerGroupTest method testCreateQueryServiceMetricInfo.

@Test
public void testCreateQueryServiceMetricInfo() {
    MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
    TaskManagerMetricGroup tm = new TaskManagerMetricGroup(registry, "host", "id");
    QueryScopeInfo.TaskManagerQueryScopeInfo info = tm.createQueryServiceMetricInfo(new DummyCharacterFilter());
    assertEquals("", info.scope);
    assertEquals("id", info.taskManagerID);
}
Also used : QueryScopeInfo(org.apache.flink.runtime.metrics.dump.QueryScopeInfo) MetricRegistry(org.apache.flink.runtime.metrics.MetricRegistry) DummyCharacterFilter(org.apache.flink.runtime.metrics.util.DummyCharacterFilter) Test(org.junit.Test)

Example 37 with MetricRegistry

use of org.apache.flink.runtime.metrics.MetricRegistry in project flink by apache.

the class TaskManagerGroupTest method testCloseClosesAll.

@Test
public void testCloseClosesAll() throws IOException {
    MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
    final TaskManagerMetricGroup group = new TaskManagerMetricGroup(registry, "localhost", new AbstractID().toString());
    final JobID jid1 = new JobID();
    final JobID jid2 = new JobID();
    final String jobName1 = "testjob";
    final String jobName2 = "anotherJob";
    final JobVertexID vertex11 = new JobVertexID();
    final JobVertexID vertex12 = new JobVertexID();
    final JobVertexID vertex21 = new JobVertexID();
    final ExecutionAttemptID execution11 = new ExecutionAttemptID();
    final ExecutionAttemptID execution12 = new ExecutionAttemptID();
    final ExecutionAttemptID execution21 = new ExecutionAttemptID();
    TaskMetricGroup tmGroup11 = group.addTaskForJob(jid1, jobName1, vertex11, execution11, "test", 17, 0);
    TaskMetricGroup tmGroup12 = group.addTaskForJob(jid1, jobName1, vertex12, execution12, "test", 13, 1);
    TaskMetricGroup tmGroup21 = group.addTaskForJob(jid2, jobName2, vertex21, execution21, "test", 7, 1);
    group.close();
    assertTrue(tmGroup11.isClosed());
    assertTrue(tmGroup12.isClosed());
    assertTrue(tmGroup21.isClosed());
    registry.shutdown();
}
Also used : ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) MetricRegistry(org.apache.flink.runtime.metrics.MetricRegistry) JobVertexID(org.apache.flink.runtime.jobgraph.JobVertexID) AbstractID(org.apache.flink.util.AbstractID) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 38 with MetricRegistry

use of org.apache.flink.runtime.metrics.MetricRegistry in project flink by apache.

the class TaskManagerJobGroupTest method testGenerateScopeDefault.

@Test
public void testGenerateScopeDefault() {
    MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
    TaskManagerMetricGroup tmGroup = new TaskManagerMetricGroup(registry, "theHostName", "test-tm-id");
    JobMetricGroup jmGroup = new TaskManagerJobMetricGroup(registry, tmGroup, new JobID(), "myJobName");
    assertArrayEquals(new String[] { "theHostName", "taskmanager", "test-tm-id", "myJobName" }, jmGroup.getScopeComponents());
    assertEquals("theHostName.taskmanager.test-tm-id.myJobName.name", jmGroup.getMetricIdentifier("name"));
    registry.shutdown();
}
Also used : MetricRegistry(org.apache.flink.runtime.metrics.MetricRegistry) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 39 with MetricRegistry

use of org.apache.flink.runtime.metrics.MetricRegistry in project flink by apache.

the class TaskManagerJobGroupTest method testGenerateScopeCustomWildcard.

@Test
public void testGenerateScopeCustomWildcard() {
    Configuration cfg = new Configuration();
    cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_TM, "peter.<tm_id>");
    cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_TM_JOB, "*.some-constant.<job_id>");
    MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.fromConfiguration(cfg));
    JobID jid = new JobID();
    TaskManagerMetricGroup tmGroup = new TaskManagerMetricGroup(registry, "theHostName", "test-tm-id");
    JobMetricGroup jmGroup = new TaskManagerJobMetricGroup(registry, tmGroup, jid, "myJobName");
    assertArrayEquals(new String[] { "peter", "test-tm-id", "some-constant", jid.toString() }, jmGroup.getScopeComponents());
    assertEquals("peter.test-tm-id.some-constant." + jid + ".name", jmGroup.getMetricIdentifier("name"));
    registry.shutdown();
}
Also used : MetricRegistryConfiguration(org.apache.flink.runtime.metrics.MetricRegistryConfiguration) Configuration(org.apache.flink.configuration.Configuration) MetricRegistry(org.apache.flink.runtime.metrics.MetricRegistry) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 40 with MetricRegistry

use of org.apache.flink.runtime.metrics.MetricRegistry in project flink by apache.

the class TaskMetricGroupTest method testGenerateScopeWilcard.

@Test
public void testGenerateScopeWilcard() {
    Configuration cfg = new Configuration();
    cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_TASK, "*.<task_attempt_id>.<subtask_index>");
    MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.fromConfiguration(cfg));
    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, new AbstractID(), executionId, "aTaskName", 13, 1);
    assertArrayEquals(new String[] { "theHostName", "taskmanager", "test-tm-id", "myJobName", executionId.toString(), "13" }, taskGroup.getScopeComponents());
    assertEquals("theHostName.taskmanager.test-tm-id.myJobName." + executionId + ".13.name", taskGroup.getMetricIdentifier("name"));
    registry.shutdown();
}
Also used : Configuration(org.apache.flink.configuration.Configuration) MetricRegistryConfiguration(org.apache.flink.runtime.metrics.MetricRegistryConfiguration) 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

MetricRegistry (org.apache.flink.runtime.metrics.MetricRegistry)53 Test (org.junit.Test)47 Configuration (org.apache.flink.configuration.Configuration)27 JobID (org.apache.flink.api.common.JobID)26 MetricRegistryConfiguration (org.apache.flink.runtime.metrics.MetricRegistryConfiguration)25 AbstractID (org.apache.flink.util.AbstractID)13 TaskManagerMetricGroup (org.apache.flink.runtime.metrics.groups.TaskManagerMetricGroup)12 MetricReporter (org.apache.flink.metrics.reporter.MetricReporter)7 QueryScopeInfo (org.apache.flink.runtime.metrics.dump.QueryScopeInfo)7 DummyCharacterFilter (org.apache.flink.runtime.metrics.util.DummyCharacterFilter)7 Counter (org.apache.flink.metrics.Counter)4 MetricGroup (org.apache.flink.metrics.MetricGroup)4 ResourceID (org.apache.flink.runtime.clusterframework.types.ResourceID)4 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)4 ActorRef (akka.actor.ActorRef)3 UUID (java.util.UUID)3 ObjectName (javax.management.ObjectName)3 Time (org.apache.flink.api.common.time.Time)3 Gauge (org.apache.flink.metrics.Gauge)3 SimpleCounter (org.apache.flink.metrics.SimpleCounter)3