org.apache.hadoop.metrics2.lib
Class AbstractMetricsSource

java.lang.Object
  extended by org.apache.hadoop.metrics2.lib.AbstractMetricsSource
All Implemented Interfaces:
MetricsSource
Direct Known Subclasses:
RpcInstrumentation.Detailed

public abstract class AbstractMetricsSource
extends Object
implements MetricsSource

A convenient base class for writing metrics sources


Field Summary
protected  MetricsRegistry registry
           
 
Constructor Summary
AbstractMetricsSource(String name)
          Construct the source with a name with a default factory
AbstractMetricsSource(String name, MetricMutableFactory mf)
          Construct the source with name and a mutable metrics factory
 
Method Summary
 void getMetrics(MetricsBuilder builder, boolean all)
          Get metrics from the source
 MetricsRegistry registry()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

registry

protected final MetricsRegistry registry
Constructor Detail

AbstractMetricsSource

public AbstractMetricsSource(String name,
                             MetricMutableFactory mf)
Construct the source with name and a mutable metrics factory

Parameters:
name - of the default record
mf - the factory to create mutable metrics

AbstractMetricsSource

public AbstractMetricsSource(String name)
Construct the source with a name with a default factory

Parameters:
name - of the default record
Method Detail

registry

public MetricsRegistry registry()
Returns:
the registry for mutable metrics

getMetrics

public void getMetrics(MetricsBuilder builder,
                       boolean all)
Description copied from interface: MetricsSource
Get metrics from the source

Specified by:
getMetrics in interface MetricsSource
Parameters:
builder - to contain the resulting metrics snapshot
all - if true, return all metrics even if unchanged.


Copyright © 2009 The Apache Software Foundation