Search in sources :

Example 26 with MetricsSource

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;
}
Also used : MetricsCollector(org.apache.hadoop.metrics2.MetricsCollector) MetricsRecordBuilder(org.apache.hadoop.metrics2.MetricsRecordBuilder)

Example 27 with MetricsSource

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);
}
Also used : MetricsConfig(org.apache.hadoop.metrics2.impl.MetricsConfig)

Example 28 with MetricsSource

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);
}
Also used : MetricsSource(org.apache.hadoop.metrics2.MetricsSource)

Aggregations

MetricsSource (org.apache.hadoop.metrics2.MetricsSource)21 Test (org.junit.Test)17 MetricsRecordBuilder (org.apache.hadoop.metrics2.MetricsRecordBuilder)9 MetricsSourceBuilder (org.apache.hadoop.metrics2.lib.MetricsSourceBuilder)4 MetricsSystem (org.apache.hadoop.metrics2.MetricsSystem)3 MetricsCollectorImpl (org.apache.hadoop.metrics2.impl.MetricsCollectorImpl)3 DefaultMetricsSystem (org.apache.hadoop.metrics2.lib.DefaultMetricsSystem)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 MetricsCollector (org.apache.hadoop.metrics2.MetricsCollector)2 MetricsTag (org.apache.hadoop.metrics2.MetricsTag)2 DynamicMetricsRegistry (org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry)2 HashMap (java.util.HashMap)1 MBeanAttributeInfo (javax.management.MBeanAttributeInfo)1 MBeanInfo (javax.management.MBeanInfo)1 Configuration (org.apache.hadoop.conf.Configuration)1 MetricsReplicationGlobalSourceSource (org.apache.hadoop.hbase.replication.regionserver.MetricsReplicationGlobalSourceSource)1 MetricsReplicationGlobalSourceSourceImpl (org.apache.hadoop.hbase.replication.regionserver.MetricsReplicationGlobalSourceSourceImpl)1 MetricsReplicationSourceImpl (org.apache.hadoop.hbase.replication.regionserver.MetricsReplicationSourceImpl)1 MetricsReplicationSourceSource (org.apache.hadoop.hbase.replication.regionserver.MetricsReplicationSourceSource)1