Search in sources :

Example 36 with MetricsSystem

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

the class TestRollingFileSystemSinkWithSecureHdfs method testWithSecureHDFS.

/**
   * Do a basic write test against an HDFS cluster with Kerberos enabled. We
   * assume that if a basic write succeeds, more complex operations will also
   * succeed.
   *
   * @throws Exception thrown if things break
   */
@Test
public void testWithSecureHDFS() throws Exception {
    final String path = "hdfs://" + cluster.getNameNode().getHostAndPort() + "/tmp/test";
    final MetricsSystem ms = initMetricsSystem(path, true, false, true);
    assertMetricsContents(sink.doAs(new PrivilegedExceptionAction<String>() {

        @Override
        public String run() throws Exception {
            return doWriteTest(ms, path, 1);
        }
    }));
}
Also used : MetricsSystem(org.apache.hadoop.metrics2.MetricsSystem) PrivilegedExceptionAction(java.security.PrivilegedExceptionAction) Test(org.junit.Test)

Example 37 with MetricsSystem

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

the class TimelineDataManagerMetrics method create.

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

Example 38 with MetricsSystem

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

the class ClusterMetrics method registerMetrics.

private static void registerMetrics() {
    registry = new MetricsRegistry(RECORD_INFO);
    registry.tag(RECORD_INFO, "ResourceManager");
    MetricsSystem ms = DefaultMetricsSystem.instance();
    if (ms != null) {
        ms.register("ClusterMetrics", "Metrics for the Yarn Cluster", INSTANCE);
    }
}
Also used : MetricsRegistry(org.apache.hadoop.metrics2.lib.MetricsRegistry) 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