Search in sources :

Example 26 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 + "(PID: " + daemonPid + ")").tag(SessionId, sessionId);
    getJvmMetrics(rb);
}
Also used : MetricsRecordBuilder(org.apache.hadoop.metrics2.MetricsRecordBuilder)

Example 27 with MetricsCollector

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

the class TestTopMetrics method testPresence.

@Test
public void testPresence() {
    Configuration conf = new Configuration();
    TopConf topConf = new TopConf(conf);
    TopMetrics topMetrics = new TopMetrics(conf, topConf.nntopReportingPeriodsMs);
    // Dummy command
    topMetrics.report("test", "listStatus");
    topMetrics.report("test", "listStatus");
    topMetrics.report("test", "listStatus");
    MetricsRecordBuilder rb = getMetrics(topMetrics);
    MetricsCollector mc = rb.parent();
    verify(mc).addRecord(TOPMETRICS_METRICS_SOURCE_NAME + ".windowMs=60000");
    verify(mc).addRecord(TOPMETRICS_METRICS_SOURCE_NAME + ".windowMs=300000");
    verify(mc).addRecord(TOPMETRICS_METRICS_SOURCE_NAME + ".windowMs=1500000");
    verify(rb, times(3)).addCounter(Interns.info("op=listStatus.TotalCount", "Total operation count"), 3L);
    verify(rb, times(3)).addCounter(Interns.info("op=*.TotalCount", "Total operation count"), 3L);
    verify(rb, times(3)).addCounter(Interns.info("op=listStatus." + "user=test.count", "Total operations performed by user"), 3L);
}
Also used : MetricsCollector(org.apache.hadoop.metrics2.MetricsCollector) Configuration(org.apache.hadoop.conf.Configuration) TopMetrics(org.apache.hadoop.hdfs.server.namenode.top.metrics.TopMetrics) TopConf(org.apache.hadoop.hdfs.server.namenode.top.TopConf) MetricsRecordBuilder(org.apache.hadoop.metrics2.MetricsRecordBuilder) Test(org.junit.Test)

Example 28 with MetricsCollector

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

the class DecayRpcScheduler method getMetrics.

@Override
public void getMetrics(MetricsCollector collector, boolean all) {
    // Metrics2 interface to act as a Metric source
    try {
        MetricsRecordBuilder rb = collector.addRecord(getClass().getName()).setContext(namespace);
        addDecayedCallVolume(rb);
        addUniqueIdentityCount(rb);
        addTopNCallerSummary(rb);
        addAvgResponseTimePerPriority(rb);
        addCallVolumePerPriority(rb);
        addRawCallVolume(rb);
    } catch (Exception e) {
        LOG.warn("Exception thrown while metric collection. Exception : " + e.getMessage());
    }
}
Also used : MetricsRecordBuilder(org.apache.hadoop.metrics2.MetricsRecordBuilder)

Example 29 with MetricsCollector

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

the class MetricsIOSourceImpl method getMetrics.

@Override
public void getMetrics(MetricsCollector metricsCollector, boolean all) {
    MetricsRecordBuilder mrb = metricsCollector.addRecord(metricsName);
    // wrapper can be null because this function is called inside of init.
    if (wrapper != null) {
        mrb.addCounter(Interns.info(CHECKSUM_FAILURES_KEY, CHECKSUM_FAILURES_DESC), wrapper.getChecksumFailures());
    }
    metricsRegistry.snapshot(mrb, all);
}
Also used : MetricsRecordBuilder(org.apache.hadoop.metrics2.MetricsRecordBuilder)

Example 30 with MetricsCollector

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

the class MetricsHBaseServerSourceImpl method getMetrics.

@Override
public void getMetrics(MetricsCollector metricsCollector, boolean all) {
    MetricsRecordBuilder mrb = metricsCollector.addRecord(metricsName);
    if (wrapper != null) {
        mrb.addGauge(Interns.info(QUEUE_SIZE_NAME, QUEUE_SIZE_DESC), wrapper.getTotalQueueSize()).addGauge(Interns.info(GENERAL_QUEUE_NAME, GENERAL_QUEUE_DESC), wrapper.getGeneralQueueLength()).addGauge(Interns.info(REPLICATION_QUEUE_NAME, REPLICATION_QUEUE_DESC), wrapper.getReplicationQueueLength()).addGauge(Interns.info(PRIORITY_QUEUE_NAME, PRIORITY_QUEUE_DESC), wrapper.getPriorityQueueLength()).addGauge(Interns.info(METAPRIORITY_QUEUE_NAME, METAPRIORITY_QUEUE_DESC), wrapper.getMetaPriorityQueueLength()).addGauge(Interns.info(NUM_OPEN_CONNECTIONS_NAME, NUM_OPEN_CONNECTIONS_DESC), wrapper.getNumOpenConnections()).addGauge(Interns.info(NUM_ACTIVE_HANDLER_NAME, NUM_ACTIVE_HANDLER_DESC), wrapper.getActiveRpcHandlerCount()).addGauge(Interns.info(NUM_ACTIVE_GENERAL_HANDLER_NAME, NUM_ACTIVE_GENERAL_HANDLER_DESC), wrapper.getActiveGeneralRpcHandlerCount()).addGauge(Interns.info(NUM_ACTIVE_PRIORITY_HANDLER_NAME, NUM_ACTIVE_PRIORITY_HANDLER_DESC), wrapper.getActivePriorityRpcHandlerCount()).addGauge(Interns.info(NUM_ACTIVE_REPLICATION_HANDLER_NAME, NUM_ACTIVE_REPLICATION_HANDLER_DESC), wrapper.getActiveReplicationRpcHandlerCount()).addCounter(Interns.info(NUM_GENERAL_CALLS_DROPPED_NAME, NUM_GENERAL_CALLS_DROPPED_DESC), wrapper.getNumGeneralCallsDropped()).addCounter(Interns.info(NUM_LIFO_MODE_SWITCHES_NAME, NUM_LIFO_MODE_SWITCHES_DESC), wrapper.getNumLifoModeSwitches()).addGauge(Interns.info(WRITE_QUEUE_NAME, WRITE_QUEUE_DESC), wrapper.getWriteQueueLength()).addGauge(Interns.info(READ_QUEUE_NAME, READ_QUEUE_DESC), wrapper.getReadQueueLength()).addGauge(Interns.info(SCAN_QUEUE_NAME, SCAN_QUEUE_DESC), wrapper.getScanQueueLength()).addGauge(Interns.info(NUM_ACTIVE_WRITE_HANDLER_NAME, NUM_ACTIVE_WRITE_HANDLER_DESC), wrapper.getActiveWriteRpcHandlerCount()).addGauge(Interns.info(NUM_ACTIVE_READ_HANDLER_NAME, NUM_ACTIVE_READ_HANDLER_DESC), wrapper.getActiveReadRpcHandlerCount()).addGauge(Interns.info(NUM_ACTIVE_SCAN_HANDLER_NAME, NUM_ACTIVE_SCAN_HANDLER_DESC), wrapper.getActiveScanRpcHandlerCount()).addGauge(Interns.info(NETTY_DM_USAGE_NAME, NETTY_DM_USAGE_DESC), wrapper.getNettyDmUsage());
    }
    metricsRegistry.snapshot(mrb, all);
}
Also used : MetricsRecordBuilder(org.apache.hadoop.metrics2.MetricsRecordBuilder)

Aggregations

MetricsRecordBuilder (org.apache.hadoop.metrics2.MetricsRecordBuilder)52 MetricsCollector (org.apache.hadoop.metrics2.MetricsCollector)14 Test (org.junit.Test)13 TreeMap (java.util.TreeMap)7 Map (java.util.Map)3 MetricsTag (org.apache.hadoop.metrics2.MetricsTag)3 Counter (com.codahale.metrics.Counter)2 Gauge (com.codahale.metrics.Gauge)2 Histogram (com.codahale.metrics.Histogram)2 Meter (com.codahale.metrics.Meter)2 Snapshot (com.codahale.metrics.Snapshot)2 Timer (com.codahale.metrics.Timer)2 LinkedHashMap (java.util.LinkedHashMap)2 Configuration (org.apache.hadoop.conf.Configuration)2 MetricsInfo (org.apache.hadoop.metrics2.MetricsInfo)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Entry (java.util.Map.Entry)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1