use of org.apache.flink.api.common.JobID in project flink by apache.
the class JobManagerJobGroupTest method testGenerateScopeDefault.
@Test
public void testGenerateScopeDefault() {
MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
JobManagerMetricGroup tmGroup = new JobManagerMetricGroup(registry, "theHostName");
JobMetricGroup jmGroup = new JobManagerJobMetricGroup(registry, tmGroup, new JobID(), "myJobName");
assertArrayEquals(new String[] { "theHostName", "jobmanager", "myJobName" }, jmGroup.getScopeComponents());
assertEquals("theHostName.jobmanager.myJobName.name", jmGroup.getMetricIdentifier("name"));
registry.shutdown();
}
use of org.apache.flink.api.common.JobID in project flink by apache.
the class JobManagerJobGroupTest method testGenerateScopeCustomWildcard.
@Test
public void testGenerateScopeCustomWildcard() {
Configuration cfg = new Configuration();
cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_JM, "peter");
cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_JM_JOB, "*.some-constant.<job_id>");
MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.fromConfiguration(cfg));
JobID jid = new JobID();
JobManagerMetricGroup tmGroup = new JobManagerMetricGroup(registry, "theHostName");
JobMetricGroup jmGroup = new JobManagerJobMetricGroup(registry, tmGroup, jid, "myJobName");
assertArrayEquals(new String[] { "peter", "some-constant", jid.toString() }, jmGroup.getScopeComponents());
assertEquals("peter.some-constant." + jid + ".name", jmGroup.getMetricIdentifier("name"));
registry.shutdown();
}
use of org.apache.flink.api.common.JobID in project flink by apache.
the class OperatorGroupTest method testVariables.
@Test
public void testVariables() {
MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
JobID jid = new JobID();
AbstractID tid = new AbstractID();
AbstractID eid = new AbstractID();
TaskManagerMetricGroup tmGroup = new TaskManagerMetricGroup(registry, "theHostName", "test-tm-id");
TaskManagerJobMetricGroup jmGroup = new TaskManagerJobMetricGroup(registry, tmGroup, jid, "myJobName");
TaskMetricGroup taskGroup = new TaskMetricGroup(registry, jmGroup, tid, eid, "aTaskName", 11, 0);
OperatorMetricGroup opGroup = new OperatorMetricGroup(registry, taskGroup, "myOpName");
Map<String, String> variables = opGroup.getAllVariables();
testVariable(variables, ScopeFormat.SCOPE_HOST, "theHostName");
testVariable(variables, ScopeFormat.SCOPE_TASKMANAGER_ID, "test-tm-id");
testVariable(variables, ScopeFormat.SCOPE_JOB_ID, jid.toString());
testVariable(variables, ScopeFormat.SCOPE_JOB_NAME, "myJobName");
testVariable(variables, ScopeFormat.SCOPE_TASK_VERTEX_ID, tid.toString());
testVariable(variables, ScopeFormat.SCOPE_TASK_NAME, "aTaskName");
testVariable(variables, ScopeFormat.SCOPE_TASK_ATTEMPT_ID, eid.toString());
testVariable(variables, ScopeFormat.SCOPE_TASK_SUBTASK_INDEX, "11");
testVariable(variables, ScopeFormat.SCOPE_TASK_ATTEMPT_NUM, "0");
testVariable(variables, ScopeFormat.SCOPE_OPERATOR_NAME, "myOpName");
registry.shutdown();
}
use of org.apache.flink.api.common.JobID in project flink by apache.
the class OperatorGroupTest method testGenerateScopeDefault.
@Test
public void testGenerateScopeDefault() {
MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
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(), new AbstractID(), "aTaskName", 11, 0);
OperatorMetricGroup opGroup = new OperatorMetricGroup(registry, taskGroup, "myOpName");
assertArrayEquals(new String[] { "theHostName", "taskmanager", "test-tm-id", "myJobName", "myOpName", "11" }, opGroup.getScopeComponents());
assertEquals("theHostName.taskmanager.test-tm-id.myJobName.myOpName.11.name", opGroup.getMetricIdentifier("name"));
registry.shutdown();
}
use of org.apache.flink.api.common.JobID in project flink by apache.
the class TaskManagerJobGroupTest method testGenerateScopeCustom.
@Test
public void testGenerateScopeCustom() {
Configuration cfg = new Configuration();
cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_TM, "abc");
cfg.setString(ConfigConstants.METRICS_SCOPE_NAMING_TM_JOB, "some-constant.<job_name>");
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[] { "some-constant", "myJobName" }, jmGroup.getScopeComponents());
assertEquals("some-constant.myJobName.name", jmGroup.getMetricIdentifier("name"));
registry.shutdown();
}
Aggregations