use of org.apache.hadoop.metrics2.impl.MetricsSystemImpl in project hadoop by apache.
the class TestShuffleHandler method testShuffleMetrics.
/**
* Validate shuffle connection and input/output metrics.
*
* @throws Exception exception
*/
@Test(timeout = 10000)
public void testShuffleMetrics() throws Exception {
MetricsSystem ms = new MetricsSystemImpl();
ShuffleHandler sh = new ShuffleHandler(ms);
ChannelFuture cf = make(stub(ChannelFuture.class).returning(true, false).from.isSuccess());
sh.metrics.shuffleConnections.incr();
sh.metrics.shuffleOutputBytes.incr(1 * MiB);
sh.metrics.shuffleConnections.incr();
sh.metrics.shuffleOutputBytes.incr(2 * MiB);
checkShuffleMetrics(ms, 3 * MiB, 0, 0, 2);
sh.metrics.operationComplete(cf);
sh.metrics.operationComplete(cf);
checkShuffleMetrics(ms, 3 * MiB, 1, 1, 0);
}
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 TestMetricsSystemImpl method testRegisterSourceJmxCacheTTL.
@Test
public void testRegisterSourceJmxCacheTTL() {
MetricsSystem ms = new MetricsSystemImpl();
ms.init("TestMetricsSystem");
TestSource ts = new TestSource("ts");
ms.register(ts);
MetricsSourceAdapter sa = ((MetricsSystemImpl) ms).getSourceAdapter("TestSource");
assertEquals(MetricsConfig.PERIOD_DEFAULT * 1000 + 1, sa.getJmxCacheTTL());
ms.shutdown();
}
Aggregations