List of usage examples for org.apache.hadoop.metrics2.impl MetricsSystemImpl MetricsSystemImpl
public MetricsSystemImpl()
From source file:org.apache.tez.auxservices.TestShuffleHandler.java
License:Apache License
/** * Validate shuffle connection and input/output metrics. * * @throws Exception exception//from ww w. j a v a2 s .c o m */ @Test(timeout = 10000) public void testShuffleMetrics() throws Exception { MetricsSystem ms = new MetricsSystemImpl(); ShuffleHandler sh = new ShuffleHandler(ms); ChannelFuture cf = mock(ChannelFuture.class); when(cf.isSuccess()).thenReturn(true, false); 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); }