public class DynamicMetricsRegistry extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CONTEXT_DESC
description for the context tag
|
static String |
CONTEXT_KEY
key for the context tag
|
Constructor and Description |
---|
DynamicMetricsRegistry(String name)
Construct the registry with a record name
|
DynamicMetricsRegistry(String name,
org.apache.hadoop.metrics2.lib.MetricMutableFactory factory)
Construct the registry with a name and a metric factory
|
Modifier and Type | Method and Description |
---|---|
void |
clearMetrics() |
org.apache.hadoop.metrics2.lib.MetricMutable |
get(String name)
Get a metric by name
|
MetricMutableHistogram |
getHistogram(String histoName) |
org.apache.hadoop.metrics2.lib.MetricMutableCounterLong |
getLongCounter(String counterName,
long potentialStartingValue)
Get a MetricMutableCounterLong from the storage.
|
org.apache.hadoop.metrics2.lib.MetricMutableGaugeLong |
getLongGauge(String gaugeName,
long potentialStartingValue)
Get a MetricMutableGaugeLong from the storage.
|
MetricMutableQuantiles |
getQuantile(String histoName) |
Set<Map.Entry<String,org.apache.hadoop.metrics2.lib.MetricMutable>> |
metrics()
Get the metrics
|
String |
name() |
org.apache.hadoop.metrics2.lib.MetricMutableCounterInt |
newCounter(String name,
String description,
int initValue)
Create a mutable integer counter
|
org.apache.hadoop.metrics2.lib.MetricMutableCounterLong |
newCounter(String name,
String description,
long initValue)
Create a mutable long integer counter
|
org.apache.hadoop.metrics2.lib.MetricMutableGaugeInt |
newGauge(String name,
String description,
int initValue)
Create a mutable integer gauge
|
org.apache.hadoop.metrics2.lib.MetricMutableGaugeLong |
newGauge(String name,
String description,
long initValue)
Create a mutable long integer gauge
|
MetricMutableHistogram |
newHistogram(String name)
Create a new histogram.
|
MetricMutableHistogram |
newHistogram(String name,
String desc)
Create a new histogram.
|
MetricMutableQuantiles |
newQuantile(String name)
Create a new MutableQuantile(A more accurate histogram).
|
MetricMutableQuantiles |
newQuantile(String name,
String desc)
Create a new MutableQuantile(A more accurate histogram).
|
org.apache.hadoop.metrics2.lib.MetricMutableStat |
newStat(String name)
Create a mutable metric with stats using the name only
|
org.apache.hadoop.metrics2.lib.MetricMutableStat |
newStat(String name,
String description,
String sampleName,
String valueName)
Create a mutable metric with stats
|
org.apache.hadoop.metrics2.lib.MetricMutableStat |
newStat(String name,
String description,
String sampleName,
String valueName,
boolean extended)
Create a mutable metric with stats
|
void |
removeMetric(String name)
Removes metric by name
|
DynamicMetricsRegistry |
setContext(String name)
Set the metrics context tag
|
void |
snapshot(org.apache.hadoop.metrics2.MetricsRecordBuilder builder,
boolean all)
Sample all the mutable metrics and put the snapshot in the builder
|
DynamicMetricsRegistry |
tag(String name,
String description,
String value)
Add a tag to the metrics
|
DynamicMetricsRegistry |
tag(String name,
String description,
String value,
boolean override)
Add a tag to the metrics
|
Set<Map.Entry<String,org.apache.hadoop.metrics2.MetricsTag>> |
tags()
Get the tags
|
public static final String CONTEXT_KEY
public static final String CONTEXT_DESC
public DynamicMetricsRegistry(String name)
name
- of the record of the metricspublic DynamicMetricsRegistry(String name, org.apache.hadoop.metrics2.lib.MetricMutableFactory factory)
name
- of the record of the metricsfactory
- for creating new mutable metricspublic String name()
public org.apache.hadoop.metrics2.lib.MetricMutable get(String name)
name
- of the metricpublic org.apache.hadoop.metrics2.lib.MetricMutableCounterInt newCounter(String name, String description, int initValue)
name
- of the metricdescription
- of the metricinitValue
- of the metricpublic org.apache.hadoop.metrics2.lib.MetricMutableCounterLong newCounter(String name, String description, long initValue)
name
- of the metricdescription
- of the metricinitValue
- of the metricpublic org.apache.hadoop.metrics2.lib.MetricMutableGaugeInt newGauge(String name, String description, int initValue)
name
- of the metricdescription
- of the metricinitValue
- of the metricpublic org.apache.hadoop.metrics2.lib.MetricMutableGaugeLong newGauge(String name, String description, long initValue)
name
- of the metricdescription
- of the metricinitValue
- of the metricpublic org.apache.hadoop.metrics2.lib.MetricMutableStat newStat(String name, String description, String sampleName, String valueName, boolean extended)
name
- of the metricdescription
- of the metricsampleName
- of the metric (e.g., "ops")valueName
- of the metric (e.g., "time" or "latency")extended
- produce extended stat (stdev, min/max etc.) if true.public org.apache.hadoop.metrics2.lib.MetricMutableStat newStat(String name, String description, String sampleName, String valueName)
name
- of the metricdescription
- of the metricsampleName
- of the metric (e.g., "ops")valueName
- of the metric (e.g., "time" or "latency")public org.apache.hadoop.metrics2.lib.MetricMutableStat newStat(String name)
name
- of the metricpublic MetricMutableHistogram newHistogram(String name)
name
- Name of the histogram.public MetricMutableHistogram newHistogram(String name, String desc)
name
- The name of the histogramdesc
- The description of the data in the histogram.public MetricMutableQuantiles newQuantile(String name)
name
- The name of the histogrampublic MetricMutableQuantiles newQuantile(String name, String desc)
name
- The name of the histogramdesc
- Description of the data.public DynamicMetricsRegistry setContext(String name)
name
- of the contextpublic DynamicMetricsRegistry tag(String name, String description, String value)
name
- of the tagdescription
- of the tagvalue
- of the tagpublic DynamicMetricsRegistry tag(String name, String description, String value, boolean override)
name
- of the tagdescription
- of the tagvalue
- of the tagoverride
- existing tag if truepublic Set<Map.Entry<String,org.apache.hadoop.metrics2.MetricsTag>> tags()
public Set<Map.Entry<String,org.apache.hadoop.metrics2.lib.MetricMutable>> metrics()
public void snapshot(org.apache.hadoop.metrics2.MetricsRecordBuilder builder, boolean all)
builder
- to contain the metrics snapshotall
- get all the metrics even if the values are not changed.public void removeMetric(String name)
name
- name of the metric to removepublic org.apache.hadoop.metrics2.lib.MetricMutableGaugeLong getLongGauge(String gaugeName, long potentialStartingValue)
gaugeName
- name of the gauge to create or get.potentialStartingValue
- value of the new counter if we have to create it.public org.apache.hadoop.metrics2.lib.MetricMutableCounterLong getLongCounter(String counterName, long potentialStartingValue)
counterName
- Name of the counter to getpotentialStartingValue
- starting value if we have to create a new counterpublic MetricMutableHistogram getHistogram(String histoName)
public MetricMutableQuantiles getQuantile(String histoName)
public void clearMetrics()
Copyright © 2014 The Apache Software Foundation. All rights reserved.