use of org.apache.hadoop.metrics2.MetricsSource 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;
}
use of org.apache.hadoop.metrics2.MetricsSource in project hadoop by apache.
the class MetricsSystemImpl method registerSource.
synchronized void registerSource(String name, String desc, MetricsSource source) {
checkNotNull(config, "config");
MetricsConfig conf = sourceConfigs.get(name);
MetricsSourceAdapter sa = new MetricsSourceAdapter(prefix, name, desc, source, injectedTags, period, conf != null ? conf : config.subset(SOURCE_KEY));
sources.put(name, sa);
sa.start();
LOG.debug("Registered source " + name);
}
use of org.apache.hadoop.metrics2.MetricsSource in project hbase by apache.
the class MetricsAssertHelperImpl method getMetrics.
private void getMetrics(BaseSource source) {
reset();
if (!(source instanceof MetricsSource)) {
assertTrue("The Source passed must be a MetricsSource", false);
}
MetricsSource impl = (MetricsSource) source;
impl.getMetrics(new MockMetricsBuilder(), true);
}
Aggregations