use of org.apache.hadoop.metrics2.MetricsCollector in project hbase by apache.
the class MetricsAssignmentManagerSourceImpl method getMetrics.
@Override
public void getMetrics(MetricsCollector metricsCollector, boolean all) {
MetricsRecordBuilder metricsRecordBuilder = metricsCollector.addRecord(metricsName);
metricsRegistry.snapshot(metricsRecordBuilder, all);
if (metricsAdapter != null) {
metricsAdapter.snapshotAllMetrics(registry, metricsRecordBuilder);
}
}
use of org.apache.hadoop.metrics2.MetricsCollector in project hbase by apache.
the class MetricsMasterProcSourceImpl method getMetrics.
@Override
public void getMetrics(MetricsCollector metricsCollector, boolean all) {
MetricsRecordBuilder metricsRecordBuilder = metricsCollector.addRecord(metricsName);
// masterWrapper can be null because this function is called inside of init.
if (masterWrapper != null) {
metricsRecordBuilder.addGauge(Interns.info(NUM_MASTER_WALS_NAME, NUM_MASTER_WALS_DESC), masterWrapper.getNumWALFiles());
}
metricsRegistry.snapshot(metricsRecordBuilder, all);
if (metricsAdapter != null) {
metricsAdapter.snapshotAllMetrics(registry, metricsRecordBuilder);
}
}
use of org.apache.hadoop.metrics2.MetricsCollector in project hbase by apache.
the class MetricsMasterQuotaSourceImpl method getMetrics.
@Override
public void getMetrics(MetricsCollector metricsCollector, boolean all) {
MetricsRecordBuilder record = metricsCollector.addRecord(metricsRegistry.info());
if (wrapper != null) {
// Summarize the tables
Map<String, Entry<Long, Long>> tableUsages = wrapper.getTableSpaceUtilization();
String tableSummary = "[]";
if (tableUsages != null && !tableUsages.isEmpty()) {
tableSummary = generateJsonQuotaSummary(tableUsages.entrySet(), "table");
}
record.tag(Interns.info(TABLE_QUOTA_USAGE_NAME, TABLE_QUOTA_USAGE_DESC), tableSummary);
// Summarize the namespaces
String nsSummary = "[]";
Map<String, Entry<Long, Long>> namespaceUsages = wrapper.getNamespaceSpaceUtilization();
if (namespaceUsages != null && !namespaceUsages.isEmpty()) {
nsSummary = generateJsonQuotaSummary(namespaceUsages.entrySet(), "namespace");
}
record.tag(Interns.info(NS_QUOTA_USAGE_NAME, NS_QUOTA_USAGE_DESC), nsSummary);
}
metricsRegistry.snapshot(record, all);
}
use of org.apache.hadoop.metrics2.MetricsCollector in project hbase by apache.
the class MetricsMasterSourceImpl method getMetrics.
@Override
public void getMetrics(MetricsCollector metricsCollector, boolean all) {
MetricsRecordBuilder metricsRecordBuilder = metricsCollector.addRecord(metricsName);
// metrics again.
if (masterWrapper != null && masterWrapper.isRunning()) {
// Pair<online region number, offline region number>
PairOfSameType<Integer> regionNumberPair = masterWrapper.getRegionCounts();
metricsRecordBuilder.addGauge(Interns.info(MERGE_PLAN_COUNT_NAME, MERGE_PLAN_COUNT_DESC), masterWrapper.getMergePlanCount()).addGauge(Interns.info(SPLIT_PLAN_COUNT_NAME, SPLIT_PLAN_COUNT_DESC), masterWrapper.getSplitPlanCount()).addGauge(Interns.info(MASTER_ACTIVE_TIME_NAME, MASTER_ACTIVE_TIME_DESC), masterWrapper.getActiveTime()).addGauge(Interns.info(MASTER_START_TIME_NAME, MASTER_START_TIME_DESC), masterWrapper.getStartTime()).addGauge(Interns.info(MASTER_FINISHED_INITIALIZATION_TIME_NAME, MASTER_FINISHED_INITIALIZATION_TIME_DESC), masterWrapper.getMasterInitializationTime()).addGauge(Interns.info(AVERAGE_LOAD_NAME, AVERAGE_LOAD_DESC), masterWrapper.getAverageLoad()).addGauge(Interns.info(ONLINE_REGION_COUNT_NAME, ONLINE_REGION_COUNT_DESC), regionNumberPair.getFirst()).addGauge(Interns.info(OFFLINE_REGION_COUNT_NAME, OFFLINE_REGION_COUNT_DESC), regionNumberPair.getSecond()).tag(Interns.info(LIVE_REGION_SERVERS_NAME, LIVE_REGION_SERVERS_DESC), masterWrapper.getRegionServers()).addGauge(Interns.info(NUM_REGION_SERVERS_NAME, NUMBER_OF_REGION_SERVERS_DESC), masterWrapper.getNumRegionServers()).tag(Interns.info(DEAD_REGION_SERVERS_NAME, DEAD_REGION_SERVERS_DESC), masterWrapper.getDeadRegionServers()).addGauge(Interns.info(NUM_DEAD_REGION_SERVERS_NAME, NUMBER_OF_DEAD_REGION_SERVERS_DESC), masterWrapper.getNumDeadRegionServers()).tag(Interns.info(DRAINING_REGION_SERVER_NAME, DRAINING_REGION_SERVER_DESC), masterWrapper.getDrainingRegionServers()).addGauge(Interns.info(NUM_DRAINING_REGION_SERVERS_NAME, NUMBER_OF_REGION_SERVERS_DESC), masterWrapper.getNumDrainingRegionServers()).tag(Interns.info(ZOOKEEPER_QUORUM_NAME, ZOOKEEPER_QUORUM_DESC), masterWrapper.getZookeeperQuorum()).tag(Interns.info(SERVER_NAME_NAME, SERVER_NAME_DESC), masterWrapper.getServerName()).tag(Interns.info(CLUSTER_ID_NAME, CLUSTER_ID_DESC), masterWrapper.getClusterId()).tag(Interns.info(IS_ACTIVE_MASTER_NAME, IS_ACTIVE_MASTER_DESC), String.valueOf(masterWrapper.getIsActiveMaster()));
}
metricsRegistry.snapshot(metricsRecordBuilder, all);
if (metricsAdapter != null) {
metricsAdapter.snapshotAllMetrics(registry, metricsRecordBuilder);
}
}
use of org.apache.hadoop.metrics2.MetricsCollector in project hbase by apache.
the class HBaseMetrics2HadoopMetricsAdapter method snapshotAllMetrics.
/**
* Iterates over the MetricRegistry and adds them to the {@code collector}.
*
* @param collector A metrics collector
*/
public void snapshotAllMetrics(MetricRegistry metricRegistry, MetricsCollector collector) {
MetricRegistryInfo info = metricRegistry.getMetricRegistryInfo();
MetricsRecordBuilder builder = collector.addRecord(Interns.info(info.getMetricsName(), info.getMetricsDescription()));
builder.setContext(info.getMetricsContext());
snapshotAllMetrics(metricRegistry, builder);
}
Aggregations