Search in sources :

Example 1 with MetricsSystemImpl

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);
}
Also used : ChannelFuture(org.jboss.netty.channel.ChannelFuture) MetricsSystem(org.apache.hadoop.metrics2.MetricsSystem) MetricsSystemImpl(org.apache.hadoop.metrics2.impl.MetricsSystemImpl) Test(org.junit.Test)

Example 2 with MetricsSystemImpl

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();
    }
}
Also used : MetricsSystem(org.apache.hadoop.metrics2.MetricsSystem) MetricsSystemImpl(org.apache.hadoop.metrics2.impl.MetricsSystemImpl) Test(org.junit.Test)

Example 3 with MetricsSystemImpl

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();
}
Also used : MetricsSystemImpl(org.apache.hadoop.metrics2.impl.MetricsSystemImpl) Before(org.junit.Before)

Example 4 with MetricsSystemImpl

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++;
}
Also used : MetricsSystemImpl(org.apache.hadoop.metrics2.impl.MetricsSystemImpl)

Example 5 with MetricsSystemImpl

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();
}
Also used : DefaultMetricsSystem(org.apache.hadoop.metrics2.lib.DefaultMetricsSystem) MetricsSystem(org.apache.hadoop.metrics2.MetricsSystem) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)15 MetricsSystemImpl (org.apache.hadoop.metrics2.impl.MetricsSystemImpl)9 MetricsSystem (org.apache.hadoop.metrics2.MetricsSystem)8 DefaultMetricsSystem (org.apache.hadoop.metrics2.lib.DefaultMetricsSystem)5 MetricsSink (org.apache.hadoop.metrics2.MetricsSink)4 MetricsRecord (org.apache.hadoop.metrics2.MetricsRecord)3 MetricsSource (org.apache.hadoop.metrics2.MetricsSource)2 ConfigBuilder (org.apache.hadoop.metrics2.impl.ConfigBuilder)2 ChannelFuture (org.jboss.netty.channel.ChannelFuture)2 Before (org.junit.Before)2 Predicate (com.google.common.base.Predicate)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 Pattern (java.util.regex.Pattern)1 Nullable (javax.annotation.Nullable)1 AbstractMetric (org.apache.hadoop.metrics2.AbstractMetric)1 AbstractGangliaSink (org.apache.hadoop.metrics2.sink.ganglia.AbstractGangliaSink)1 GangliaSink30 (org.apache.hadoop.metrics2.sink.ganglia.GangliaSink30)1 GangliaSink31 (org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31)1