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);
}
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);
}
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());
}
}
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);
}
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);
}
Aggregations