Search in sources :

Example 16 with MetricRegistry

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

Example 17 with MetricRegistry

use of org.apache.flink.runtime.metrics.MetricRegistry 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();
}
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 18 with MetricRegistry

use of org.apache.flink.runtime.metrics.MetricRegistry 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();
}
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)

Example 19 with MetricRegistry

use of org.apache.flink.runtime.metrics.MetricRegistry 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();
}
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)

Example 20 with MetricRegistry

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

the class TaskManagerGroupTest method testGenerateScopeDefault.

// ------------------------------------------------------------------------
//  scope name tests
// ------------------------------------------------------------------------
@Test
public void testGenerateScopeDefault() {
    MetricRegistry registry = new MetricRegistry(MetricRegistryConfiguration.defaultMetricRegistryConfiguration());
    TaskManagerMetricGroup group = new TaskManagerMetricGroup(registry, "localhost", "id");
    assertArrayEquals(new String[] { "localhost", "taskmanager", "id" }, group.getScopeComponents());
    assertEquals("localhost.taskmanager.id.name", group.getMetricIdentifier("name"));
    registry.shutdown();
}
Also used : MetricRegistry(org.apache.flink.runtime.metrics.MetricRegistry) 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