Search in sources :

Example 16 with MetricsSystem

use of org.apache.hadoop.metrics2.MetricsSystem 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 17 with MetricsSystem

use of org.apache.hadoop.metrics2.MetricsSystem in project hadoop by apache.

the class CSQueueMetrics method forQueue.

public static synchronized CSQueueMetrics forQueue(String queueName, Queue parent, boolean enableUserMetrics, Configuration conf) {
    MetricsSystem ms = DefaultMetricsSystem.instance();
    QueueMetrics metrics = queueMetrics.get(queueName);
    if (metrics == null) {
        metrics = new CSQueueMetrics(ms, queueName, parent, enableUserMetrics, conf).tag(QUEUE_INFO, queueName);
        // Register with the MetricsSystems
        if (ms != null) {
            metrics = ms.register(sourceName(queueName).toString(), "Metrics for queue: " + queueName, metrics);
        }
        queueMetrics.put(queueName, metrics);
    }
    return (CSQueueMetrics) metrics;
}
Also used : QueueMetrics(org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics) MetricsSystem(org.apache.hadoop.metrics2.MetricsSystem) DefaultMetricsSystem(org.apache.hadoop.metrics2.lib.DefaultMetricsSystem)

Example 18 with MetricsSystem

use of org.apache.hadoop.metrics2.MetricsSystem in project hadoop by apache.

the class TestResourceTrackerService method tearDown.

@After
public void tearDown() {
    if (hostFile != null && hostFile.exists()) {
        hostFile.delete();
    }
    ClusterMetrics.destroy();
    if (rm != null) {
        rm.stop();
    }
    MetricsSystem ms = DefaultMetricsSystem.instance();
    if (ms.getSource("ClusterMetrics") != null) {
        DefaultMetricsSystem.shutdown();
    }
}
Also used : DefaultMetricsSystem(org.apache.hadoop.metrics2.lib.DefaultMetricsSystem) MetricsSystem(org.apache.hadoop.metrics2.MetricsSystem) After(org.junit.After)

Example 19 with MetricsSystem

use of org.apache.hadoop.metrics2.MetricsSystem in project hadoop by apache.

the class ClientSCMMetrics method create.

static ClientSCMMetrics create() {
    MetricsSystem ms = DefaultMetricsSystem.instance();
    ClientSCMMetrics metrics = new ClientSCMMetrics();
    ms.register("clientRequests", null, metrics);
    return metrics;
}
Also used : MetricsSystem(org.apache.hadoop.metrics2.MetricsSystem) DefaultMetricsSystem(org.apache.hadoop.metrics2.lib.DefaultMetricsSystem)

Example 20 with MetricsSystem

use of org.apache.hadoop.metrics2.MetricsSystem in project hadoop by apache.

the class EntityGroupFSTimelineStoreMetrics method create.

public static synchronized EntityGroupFSTimelineStoreMetrics create() {
    if (instance == null) {
        MetricsSystem ms = DefaultMetricsSystem.instance();
        instance = ms.register(new EntityGroupFSTimelineStoreMetrics());
    }
    return instance;
}
Also used : MetricsSystem(org.apache.hadoop.metrics2.MetricsSystem) DefaultMetricsSystem(org.apache.hadoop.metrics2.lib.DefaultMetricsSystem)

Aggregations

MetricsSystem (org.apache.hadoop.metrics2.MetricsSystem)36 DefaultMetricsSystem (org.apache.hadoop.metrics2.lib.DefaultMetricsSystem)19 Test (org.junit.Test)19 MyMetrics1 (org.apache.hadoop.metrics2.sink.RollingFileSystemSinkTestBase.MyMetrics1)5 JvmMetrics (org.apache.hadoop.metrics2.source.JvmMetrics)5 MetricsSource (org.apache.hadoop.metrics2.MetricsSource)4 MetricsSystemImpl (org.apache.hadoop.metrics2.impl.MetricsSystemImpl)3 After (org.junit.After)2 URI (java.net.URI)1 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)1 Calendar (java.util.Calendar)1 Configuration (org.apache.hadoop.conf.Configuration)1 FileStatus (org.apache.hadoop.fs.FileStatus)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 Path (org.apache.hadoop.fs.Path)1 LlapMetricsSystem (org.apache.hadoop.hive.llap.metrics.LlapMetricsSystem)1 MetricsException (org.apache.hadoop.metrics2.MetricsException)1 MetricsRecordBuilder (org.apache.hadoop.metrics2.MetricsRecordBuilder)1 ConfigBuilder (org.apache.hadoop.metrics2.impl.ConfigBuilder)1 MetricsRegistry (org.apache.hadoop.metrics2.lib.MetricsRegistry)1