use of org.apache.hadoop.metrics2.impl.MetricsSystemImpl in project hadoop by apache.
the class TestQueueMetrics method testMetricsCache.
@Test
public void testMetricsCache() {
MetricsSystem ms = new MetricsSystemImpl("cache");
ms.start();
try {
String p1 = "root1";
String leafQueueName = "root1.leaf";
QueueMetrics p1Metrics = QueueMetrics.forQueue(ms, p1, null, true, conf);
Queue parentQueue1 = make(stub(Queue.class).returning(p1Metrics).from.getMetrics());
QueueMetrics metrics = QueueMetrics.forQueue(ms, leafQueueName, parentQueue1, true, conf);
Assert.assertNotNull("QueueMetrics for A shoudn't be null", metrics);
// Re-register to check for cache hit, shouldn't blow up metrics-system...
// also, verify parent-metrics
QueueMetrics alterMetrics = QueueMetrics.forQueue(ms, leafQueueName, parentQueue1, true, conf);
Assert.assertNotNull("QueueMetrics for alterMetrics shoudn't be null", alterMetrics);
} finally {
ms.shutdown();
}
}
use of org.apache.hadoop.metrics2.impl.MetricsSystemImpl in project hadoop by apache.
the class TestQueueMetrics method setUp.
@Before
public void setUp() {
ms = new MetricsSystemImpl();
QueueMetrics.clearQueueMetrics();
}
use of org.apache.hadoop.metrics2.impl.MetricsSystemImpl in project hadoop by apache.
the class AzureFileSystemMetricsSystem method fileSystemStarted.
public static synchronized void fileSystemStarted() {
if (numFileSystems == 0) {
instance = new MetricsSystemImpl();
instance.init("azure-file-system");
}
numFileSystems++;
}
use of org.apache.hadoop.metrics2.impl.MetricsSystemImpl in project hadoop by apache.
the class TestFSQueueMetrics method setUp.
@Before
public void setUp() {
ms = new MetricsSystemImpl();
QueueMetrics.clearQueueMetrics();
}
use of org.apache.hadoop.metrics2.impl.MetricsSystemImpl in project hadoop by apache.
the class TestContainerMetrics method testContainerMetricsFinished.
@Test
public void testContainerMetricsFinished() throws InterruptedException {
MetricsSystemImpl system = new MetricsSystemImpl();
system.init("test");
ApplicationId appId = ApplicationId.newInstance(1234, 3);
ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(appId, 4);
ContainerId containerId1 = ContainerId.newContainerId(appAttemptId, 1);
ContainerMetrics metrics1 = ContainerMetrics.forContainer(system, containerId1, 1, 0);
ContainerId containerId2 = ContainerId.newContainerId(appAttemptId, 2);
ContainerMetrics metrics2 = ContainerMetrics.forContainer(system, containerId2, 1, 0);
ContainerId containerId3 = ContainerId.newContainerId(appAttemptId, 3);
ContainerMetrics metrics3 = ContainerMetrics.forContainer(system, containerId3, 1, 0);
metrics1.finished();
metrics2.finished();
system.sampleMetrics();
system.sampleMetrics();
Thread.sleep(100);
// verify metrics1 is unregistered
assertTrue(metrics1 != ContainerMetrics.forContainer(system, containerId1, 1, 0));
// verify metrics2 is unregistered
assertTrue(metrics2 != ContainerMetrics.forContainer(system, containerId2, 1, 0));
// verify metrics3 is still registered
assertTrue(metrics3 == ContainerMetrics.forContainer(system, containerId3, 1, 0));
// YARN-5190: move stop() to the end to verify registering containerId1 and
// containerId2 won't get MetricsException thrown.
system.stop();
system.shutdown();
}
Aggregations