Search in sources :

Example 16 with MetricsCollector

use of org.apache.hadoop.metrics2.MetricsCollector in project hive by apache.

the class LlapTaskSchedulerMetrics method getMetrics.

@Override
public void getMetrics(MetricsCollector collector, boolean b) {
    MetricsRecordBuilder rb = collector.addRecord(SchedulerMetrics).setContext("scheduler").tag(ProcessName, "DAGAppMaster").tag(SessionId, sessionId);
    getTaskSchedulerStats(rb);
}
Also used : MetricsRecordBuilder(org.apache.hadoop.metrics2.MetricsRecordBuilder)

Example 17 with MetricsCollector

use of org.apache.hadoop.metrics2.MetricsCollector in project hive by apache.

the class LlapDaemonJvmMetrics method getMetrics.

@Override
public void getMetrics(MetricsCollector collector, boolean b) {
    MetricsRecordBuilder rb = collector.addRecord(LlapDaemonJVMMetrics).setContext("jvm").tag(ProcessName, MetricsUtils.METRICS_PROCESS_NAME).tag(SessionId, sessionId);
    getJvmMetrics(rb);
}
Also used : MetricsRecordBuilder(org.apache.hadoop.metrics2.MetricsRecordBuilder)

Example 18 with MetricsCollector

use of org.apache.hadoop.metrics2.MetricsCollector in project hive by apache.

the class LlapDaemonCacheMetrics method getMetrics.

@Override
public void getMetrics(MetricsCollector collector, boolean b) {
    MetricsRecordBuilder rb = collector.addRecord(CacheMetrics).setContext("cache").tag(ProcessName, MetricsUtils.METRICS_PROCESS_NAME).tag(SessionId, sessionId);
    getCacheStats(rb);
}
Also used : MetricsRecordBuilder(org.apache.hadoop.metrics2.MetricsRecordBuilder)

Example 19 with MetricsCollector

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

the class TestJvmMetrics method testPresence.

@Test
public void testPresence() {
    pauseMonitor = new JvmPauseMonitor();
    pauseMonitor.init(new Configuration());
    pauseMonitor.start();
    JvmMetrics jvmMetrics = new JvmMetrics("test", "test");
    jvmMetrics.setPauseMonitor(pauseMonitor);
    MetricsRecordBuilder rb = getMetrics(jvmMetrics);
    MetricsCollector mc = rb.parent();
    verify(mc).addRecord(JvmMetrics);
    verify(rb).tag(ProcessName, "test");
    verify(rb).tag(SessionId, "test");
    for (JvmMetricsInfo info : JvmMetricsInfo.values()) {
        if (info.name().startsWith("Mem"))
            verify(rb).addGauge(eq(info), anyFloat());
        else if (info.name().startsWith("Gc"))
            verify(rb).addCounter(eq(info), anyLong());
        else if (info.name().startsWith("Threads"))
            verify(rb).addGauge(eq(info), anyInt());
        else if (info.name().startsWith("Log"))
            verify(rb).addCounter(eq(info), anyLong());
    }
}
Also used : MetricsCollector(org.apache.hadoop.metrics2.MetricsCollector) Configuration(org.apache.hadoop.conf.Configuration) JvmMetricsInfo(org.apache.hadoop.metrics2.source.JvmMetricsInfo) JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor) MetricsRecordBuilder(org.apache.hadoop.metrics2.MetricsRecordBuilder) Test(org.junit.Test)

Example 20 with MetricsCollector

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

the class MetricsAsserts method getMetrics.

/**
   * Call getMetrics on source and get a record builder mock to verify
   * @param source  the metrics source
   * @param all     if true, return all metrics even if not changed
   * @return the record builder mock to verifyÏ
   */
public static MetricsRecordBuilder getMetrics(MetricsSource source, boolean all) {
    MetricsRecordBuilder rb = mockMetricsRecordBuilder();
    MetricsCollector mc = rb.parent();
    source.getMetrics(mc, all);
    return rb;
}
Also used : MetricsCollector(org.apache.hadoop.metrics2.MetricsCollector) MetricsRecordBuilder(org.apache.hadoop.metrics2.MetricsRecordBuilder)

Aggregations

MetricsRecordBuilder (org.apache.hadoop.metrics2.MetricsRecordBuilder)23 MetricsCollector (org.apache.hadoop.metrics2.MetricsCollector)6 Test (org.junit.Test)4 Configuration (org.apache.hadoop.conf.Configuration)2 IOException (java.io.IOException)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 MetricRegistryInfo (org.apache.hadoop.hbase.metrics.MetricRegistryInfo)1 Phase (org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase)1 StartupProgressView (org.apache.hadoop.hdfs.server.namenode.startupprogress.StartupProgressView)1 TopConf (org.apache.hadoop.hdfs.server.namenode.top.TopConf)1 TopMetrics (org.apache.hadoop.hdfs.server.namenode.top.metrics.TopMetrics)1 MetricsSource (org.apache.hadoop.metrics2.MetricsSource)1 MetricsTag (org.apache.hadoop.metrics2.MetricsTag)1 JvmMetricsInfo (org.apache.hadoop.metrics2.source.JvmMetricsInfo)1 JvmPauseMonitor (org.apache.hadoop.util.JvmPauseMonitor)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1