use of org.apache.hadoop.hbase.metrics.Meter in project hbase by apache.
the class TestMetricRegistryImpl method testMeter.
@Test
public void testMeter() {
Meter meter = registry.meter("mymeter");
assertNotNull(meter);
meter.mark();
}
use of org.apache.hadoop.hbase.metrics.Meter in project hbase by apache.
the class HBaseMetrics2HadoopMetricsAdapter method snapshotAllMetrics.
/**
* Iterates over the MetricRegistry and adds them to the {@code builder}.
*
* @param builder A record builder
*/
public void snapshotAllMetrics(MetricRegistry metricRegistry, MetricsRecordBuilder builder) {
Map<String, Metric> metrics = metricRegistry.getMetrics();
for (Map.Entry<String, Metric> e : metrics.entrySet()) {
// Always capitalize the name
String name = StringUtils.capitalize(e.getKey());
Metric metric = e.getValue();
if (metric instanceof Gauge) {
addGauge(name, (Gauge<?>) metric, builder);
} else if (metric instanceof Counter) {
addCounter(name, (Counter) metric, builder);
} else if (metric instanceof Histogram) {
addHistogram(name, (Histogram) metric, builder);
} else if (metric instanceof Meter) {
addMeter(name, (Meter) metric, builder);
} else if (metric instanceof Timer) {
addTimer(name, (Timer) metric, builder);
} else {
LOG.info("Ignoring unknown Metric class " + metric.getClass().getName());
}
}
}
Aggregations