org.apache.hadoop.hbase.metrics
Class BaseSourceImpl

java.lang.Object
  extended by org.apache.hadoop.hbase.metrics.BaseSourceImpl
All Implemented Interfaces:
BaseSource, org.apache.hadoop.metrics2.MetricsSource
Direct Known Subclasses:
MetricsAssignmentManagerSourceImpl, MetricsBalancerSourceImpl, MetricsEditsReplaySourceImpl, MetricsHBaseServerSourceImpl, MetricsMasterFilesystemSourceImpl, MetricsMasterSourceImpl, MetricsRegionAggregateSourceImpl, MetricsRegionServerSourceImpl, MetricsReplicationSourceImpl, MetricsRESTSourceImpl, MetricsSnapshotSourceImpl, MetricsThriftServerSourceImpl, MetricsWALSourceImpl

@InterfaceAudience.Private
public class BaseSourceImpl
extends Object
implements BaseSource, org.apache.hadoop.metrics2.MetricsSource

Hadoop 2 implementation of BaseSource (using metrics2 framework). It handles registration to DefaultMetricsSystem and creation of the metrics registry. All MetricsSource's in hbase-hadoop2-compat should derive from this class.


Field Summary
protected  String metricsContext
           
protected  String metricsDescription
           
protected  String metricsJmxContext
           
protected  String metricsName
           
protected  DynamicMetricsRegistry metricsRegistry
           
 
Fields inherited from interface org.apache.hadoop.hbase.metrics.BaseSource
HBASE_METRICS_SYSTEM_NAME
 
Constructor Summary
BaseSourceImpl(String metricsName, String metricsDescription, String metricsContext, String metricsJmxContext)
           
 
Method Summary
 void decGauge(String gaugeName, long delta)
          Decrease the value of a named gauge.
 void getMetrics(org.apache.hadoop.metrics2.MetricsCollector metricsCollector, boolean all)
           
 String getMetricsContext()
          Get the metrics context.
 String getMetricsDescription()
          Get the description of what this source exposes.
 String getMetricsJmxContext()
          Get the name of the context in JMX that this source will be exposed through.
 String getMetricsName()
          Get the name of the metrics that are being exported by this source.
 DynamicMetricsRegistry getMetricsRegistry()
           
 void incCounters(String key, long delta)
          Increment a named counter by some value.
 void incGauge(String gaugeName, long delta)
          Add some amount to a gauge.
 void init()
          Clear out the metrics and re-prepare the source.
 void removeMetric(String key)
          Remove a named gauge.
 void setGauge(String gaugeName, long value)
          Set a single gauge to a value.
 void updateHistogram(String name, long value)
          Add some value to a histogram.
 void updateQuantile(String name, long value)
          Add some value to a Quantile (An accurate histogram).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

metricsRegistry

protected final DynamicMetricsRegistry metricsRegistry

metricsName

protected final String metricsName

metricsDescription

protected final String metricsDescription

metricsContext

protected final String metricsContext

metricsJmxContext

protected final String metricsJmxContext
Constructor Detail

BaseSourceImpl

public BaseSourceImpl(String metricsName,
                      String metricsDescription,
                      String metricsContext,
                      String metricsJmxContext)
Method Detail

init

public void init()
Description copied from interface: BaseSource
Clear out the metrics and re-prepare the source.

Specified by:
init in interface BaseSource

setGauge

public void setGauge(String gaugeName,
                     long value)
Set a single gauge to a value.

Specified by:
setGauge in interface BaseSource
Parameters:
gaugeName - gauge name
value - the new value of the gauge.

incGauge

public void incGauge(String gaugeName,
                     long delta)
Add some amount to a gauge.

Specified by:
incGauge in interface BaseSource
Parameters:
gaugeName - The name of the gauge to increment.
delta - The amount to increment the gauge by.

decGauge

public void decGauge(String gaugeName,
                     long delta)
Decrease the value of a named gauge.

Specified by:
decGauge in interface BaseSource
Parameters:
gaugeName - The name of the gauge.
delta - the ammount to subtract from a gauge value.

incCounters

public void incCounters(String key,
                        long delta)
Increment a named counter by some value.

Specified by:
incCounters in interface BaseSource
Parameters:
key - the name of the counter
delta - the ammount to increment

updateHistogram

public void updateHistogram(String name,
                            long value)
Description copied from interface: BaseSource
Add some value to a histogram.

Specified by:
updateHistogram in interface BaseSource
Parameters:
name - the name of the histogram
value - the value to add to the histogram

updateQuantile

public void updateQuantile(String name,
                           long value)
Description copied from interface: BaseSource
Add some value to a Quantile (An accurate histogram).

Specified by:
updateQuantile in interface BaseSource
Parameters:
name - the name of the quantile
value - the value to add to the quantile

removeMetric

public void removeMetric(String key)
Remove a named gauge.

Specified by:
removeMetric in interface BaseSource
Parameters:
key -

getMetrics

public void getMetrics(org.apache.hadoop.metrics2.MetricsCollector metricsCollector,
                       boolean all)
Specified by:
getMetrics in interface org.apache.hadoop.metrics2.MetricsSource

getMetricsRegistry

public DynamicMetricsRegistry getMetricsRegistry()

getMetricsContext

public String getMetricsContext()
Description copied from interface: BaseSource
Get the metrics context. For hadoop metrics2 system this is usually an all lowercased string. eg. regionserver, master, thriftserver

Specified by:
getMetricsContext in interface BaseSource
Returns:
The string context used to register this source to hadoop's metrics2 system.

getMetricsDescription

public String getMetricsDescription()
Description copied from interface: BaseSource
Get the description of what this source exposes.

Specified by:
getMetricsDescription in interface BaseSource

getMetricsJmxContext

public String getMetricsJmxContext()
Description copied from interface: BaseSource
Get the name of the context in JMX that this source will be exposed through. This is in ObjectName format. With the default context being Hadoop -> HBase

Specified by:
getMetricsJmxContext in interface BaseSource

getMetricsName

public String getMetricsName()
Description copied from interface: BaseSource
Get the name of the metrics that are being exported by this source. Eg. IPC, GC, WAL

Specified by:
getMetricsName in interface BaseSource


Copyright © 2015 The Apache Software Foundation. All rights reserved.