@InterfaceAudience.Private public class DynamicMetricsRegistry extends Object
Modifier and Type | Field and Description |
---|---|
private DefaultMetricsSystemHelper |
helper |
private static String[] |
histogramSuffixes |
private static org.slf4j.Logger |
LOG |
private org.apache.hadoop.metrics2.MetricsInfo |
metricsInfo |
private ConcurrentMap<String,org.apache.hadoop.metrics2.lib.MutableMetric> |
metricsMap |
private ConcurrentMap<String,org.apache.hadoop.metrics2.MetricsTag> |
tagsMap |
Constructor and Description |
---|
DynamicMetricsRegistry(org.apache.hadoop.metrics2.MetricsInfo info)
Construct the registry with a metadata object
|
DynamicMetricsRegistry(String name)
Construct the registry with a record name
|
Modifier and Type | Method and Description |
---|---|
void |
add(String name,
long value)
Add sample to a stat metric by name.
|
(package private) void |
add(String name,
org.apache.hadoop.metrics2.lib.MutableMetric metric) |
private <T extends org.apache.hadoop.metrics2.lib.MutableMetric> |
addNewMetricIfAbsent(String name,
T ret,
Class<T> metricClass) |
void |
clearMetrics() |
org.apache.hadoop.metrics2.lib.MutableMetric |
get(String name)
Get a metric by name
|
MutableFastCounter |
getCounter(String counterName,
long potentialStartingValue)
Get a MetricMutableCounterLong from the storage.
|
org.apache.hadoop.metrics2.lib.MutableGaugeLong |
getGauge(String gaugeName,
long potentialStartingValue)
Get a MetricMutableGaugeLong from the storage.
|
MutableHistogram |
getHistogram(String histoName) |
org.apache.hadoop.metrics2.MetricsTag |
getTag(String name)
Get a tag by name
|
org.apache.hadoop.metrics2.MetricsInfo |
info() |
(package private) Collection<org.apache.hadoop.metrics2.lib.MutableMetric> |
metrics() |
MutableFastCounter |
newCounter(org.apache.hadoop.metrics2.MetricsInfo info,
long iVal)
Create a mutable long integer counter
|
MutableFastCounter |
newCounter(String name,
String desc,
long iVal)
Create a mutable long integer counter
|
org.apache.hadoop.metrics2.lib.MutableGaugeLong |
newGauge(org.apache.hadoop.metrics2.MetricsInfo info,
long iVal)
Create a mutable long integer gauge
|
org.apache.hadoop.metrics2.lib.MutableGaugeLong |
newGauge(String name,
String desc,
long iVal)
Create a mutable long integer gauge
|
MutableHistogram |
newHistogram(String name)
Create a new histogram.
|
MutableHistogram |
newHistogram(String name,
String desc)
Create a new histogram.
|
org.apache.hadoop.metrics2.lib.MutableRate |
newRate(String name)
Create a mutable rate metric
|
org.apache.hadoop.metrics2.lib.MutableRate |
newRate(String name,
String description)
Create a mutable rate metric
|
org.apache.hadoop.metrics2.lib.MutableRate |
newRate(String name,
String desc,
boolean extended)
Create a mutable rate metric (for throughput measurement)
|
org.apache.hadoop.metrics2.lib.MutableRate |
newRate(String name,
String desc,
boolean extended,
boolean returnExisting) |
MutableSizeHistogram |
newSizeHistogram(String name)
Create a new histogram with size range counts.
|
MutableSizeHistogram |
newSizeHistogram(String name,
String desc)
Create a new histogram with size range counts.
|
org.apache.hadoop.metrics2.lib.MutableStat |
newStat(String name,
String desc,
String sampleName,
String valueName)
Create a mutable metric with stats
|
org.apache.hadoop.metrics2.lib.MutableStat |
newStat(String name,
String desc,
String sampleName,
String valueName,
boolean extended)
Create a mutable metric with stats
|
MutableTimeHistogram |
newTimeHistogram(String name)
Create a new histogram with time range counts.
|
MutableTimeHistogram |
newTimeHistogram(String name,
String desc)
Create a new histogram with time range counts.
|
void |
removeHistogramMetrics(String baseName) |
void |
removeMetric(String name)
Removes metric by name
|
private <T> T |
returnExistingWithCast(org.apache.hadoop.metrics2.lib.MutableMetric metric,
Class<T> metricClass,
String 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(org.apache.hadoop.metrics2.MetricsInfo info,
String value) |
DynamicMetricsRegistry |
tag(org.apache.hadoop.metrics2.MetricsInfo info,
String value,
boolean override)
Add a tag to the metrics
|
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
|
(package private) Collection<org.apache.hadoop.metrics2.MetricsTag> |
tags() |
String |
toString() |
private static final org.slf4j.Logger LOG
private final ConcurrentMap<String,org.apache.hadoop.metrics2.lib.MutableMetric> metricsMap
private final ConcurrentMap<String,org.apache.hadoop.metrics2.MetricsTag> tagsMap
private final org.apache.hadoop.metrics2.MetricsInfo metricsInfo
private final DefaultMetricsSystemHelper helper
private static final String[] histogramSuffixes
public DynamicMetricsRegistry(String name)
name
- of the record of the metricspublic DynamicMetricsRegistry(org.apache.hadoop.metrics2.MetricsInfo info)
info
- the info object for the metrics record/grouppublic org.apache.hadoop.metrics2.MetricsInfo info()
public org.apache.hadoop.metrics2.lib.MutableMetric get(String name)
name
- of the metricpublic org.apache.hadoop.metrics2.MetricsTag getTag(String name)
name
- of the tagpublic MutableFastCounter newCounter(String name, String desc, long iVal)
name
- of the metricdesc
- metric descriptioniVal
- initial valuepublic MutableFastCounter newCounter(org.apache.hadoop.metrics2.MetricsInfo info, long iVal)
info
- metadata of the metriciVal
- initial valuepublic org.apache.hadoop.metrics2.lib.MutableGaugeLong newGauge(String name, String desc, long iVal)
name
- of the metricdesc
- metric descriptioniVal
- initial valuepublic org.apache.hadoop.metrics2.lib.MutableGaugeLong newGauge(org.apache.hadoop.metrics2.MetricsInfo info, long iVal)
info
- metadata of the metriciVal
- initial valuepublic org.apache.hadoop.metrics2.lib.MutableStat newStat(String name, String desc, String sampleName, String valueName, boolean extended)
name
- of the metricdesc
- metric descriptionsampleName
- 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.MutableStat newStat(String name, String desc, String sampleName, String valueName)
name
- of the metricdesc
- metric descriptionsampleName
- of the metric (e.g., "Ops")valueName
- of the metric (e.g., "Time" or "Latency")public org.apache.hadoop.metrics2.lib.MutableRate newRate(String name)
name
- of the metricpublic org.apache.hadoop.metrics2.lib.MutableRate newRate(String name, String description)
name
- of the metricdescription
- of the metricpublic org.apache.hadoop.metrics2.lib.MutableRate newRate(String name, String desc, boolean extended)
name
- of the metricdesc
- descriptionextended
- produce extended stat (stdev/min/max etc.) if true@InterfaceAudience.Private public org.apache.hadoop.metrics2.lib.MutableRate newRate(String name, String desc, boolean extended, boolean returnExisting)
public MutableHistogram newHistogram(String name)
name
- Name of the histogram.public MutableHistogram newHistogram(String name, String desc)
name
- The name of the histogramdesc
- The description of the data in the histogram.public MutableTimeHistogram newTimeHistogram(String name)
name
- Name of the histogram.public MutableTimeHistogram newTimeHistogram(String name, String desc)
name
- The name of the histogramdesc
- The description of the data in the histogram.public MutableSizeHistogram newSizeHistogram(String name)
name
- Name of the histogram.public MutableSizeHistogram newSizeHistogram(String name, String desc)
name
- The name of the histogramdesc
- The description of the data in the histogram.public void add(String name, long value)
name
- of the metricvalue
- of the snapshot to addpublic 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 DynamicMetricsRegistry tag(org.apache.hadoop.metrics2.MetricsInfo info, String value, boolean override)
info
- metadata of the tagvalue
- of the tagoverride
- existing tag if truepublic DynamicMetricsRegistry tag(org.apache.hadoop.metrics2.MetricsInfo info, String value)
Collection<org.apache.hadoop.metrics2.MetricsTag> tags()
Collection<org.apache.hadoop.metrics2.lib.MutableMetric> 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 void removeHistogramMetrics(String baseName)
public org.apache.hadoop.metrics2.lib.MutableGaugeLong getGauge(String gaugeName, long potentialStartingValue)
gaugeName
- name of the gauge to create or get.potentialStartingValue
- value of the new gauge if we have to create it.public MutableFastCounter getCounter(String counterName, long potentialStartingValue)
counterName
- Name of the counter to getpotentialStartingValue
- starting value if we have to create a new counterpublic MutableHistogram getHistogram(String histoName)
private <T extends org.apache.hadoop.metrics2.lib.MutableMetric> T addNewMetricIfAbsent(String name, T ret, Class<T> metricClass)
private <T> T returnExistingWithCast(org.apache.hadoop.metrics2.lib.MutableMetric metric, Class<T> metricClass, String name)
public void clearMetrics()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.