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);
}
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();
}
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();
}
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();
}
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();
}
Aggregations