|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.metrics2.lib.MetricsRegistry
public class MetricsRegistry
An optional metrics registry class for creating and maintaining a collection of MetricsMutables, making writing metrics source easier.
Field Summary | |
---|---|
static String |
CONTEXT_DESC
description for the context tag |
static String |
CONTEXT_KEY
key for the context tag |
Constructor Summary | |
---|---|
MetricsRegistry(String name)
Construct the registry with a record name |
|
MetricsRegistry(String name,
MetricMutableFactory factory)
Construct the registry with a name and a metric factory |
Method Summary | |
---|---|
void |
add(String name,
long value)
Add a value to a metric by name. |
void |
add(String name,
long value,
MetricMutableFactory factory)
Decrement a metric by name. |
void |
decr(String name)
Decrement a metric by name. |
void |
decr(String name,
MetricMutableFactory factory)
Decrement a metric by name. |
MetricMutable |
get(String name)
Get a metric by name |
void |
incr(String name)
Increment a metric by name. |
void |
incr(String name,
MetricMutableFactory factory)
Increment a metric by name. |
Set<Map.Entry<String,MetricMutable>> |
metrics()
Get the metrics |
String |
name()
|
MetricMutableCounterInt |
newCounter(String name,
String description,
int initValue)
Create a mutable integer counter |
MetricMutableCounterLong |
newCounter(String name,
String description,
long initValue)
Create a mutable long integer counter |
MetricMutableGaugeInt |
newGauge(String name,
String description,
int initValue)
Create a mutable integer gauge |
MetricMutableGaugeLong |
newGauge(String name,
String description,
long initValue)
Create a mutable long integer gauge |
MetricMutableStat |
newStat(String name)
Create a mutable metric with stats using the name only |
MetricMutableStat |
newStat(String name,
String description,
String sampleName,
String valueName)
Create a mutable metric with stats |
MetricMutableStat |
newStat(String name,
String description,
String sampleName,
String valueName,
boolean extended)
Create a mutable metric with stats |
MetricsRegistry |
setContext(String name)
Set the metrics context tag |
void |
snapshot(MetricsRecordBuilder builder,
boolean all)
Sample all the mutable metrics and put the snapshot in the builder |
MetricsRegistry |
tag(String name,
String description,
String value)
Add a tag to the metrics |
MetricsRegistry |
tag(String name,
String description,
String value,
boolean override)
Add a tag to the metrics |
Set<Map.Entry<String,MetricsTag>> |
tags()
Get the tags |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CONTEXT_KEY
public static final String CONTEXT_DESC
Constructor Detail |
---|
public MetricsRegistry(String name)
name
- of the record of the metricspublic MetricsRegistry(String name, MetricMutableFactory factory)
name
- of the record of the metricsfactory
- for creating new mutable metricsMethod Detail |
---|
public String name()
public MetricMutable get(String name)
name
- of the metric
public MetricMutableCounterInt newCounter(String name, String description, int initValue)
name
- of the metricdescription
- of the metricinitValue
- of the metric
public MetricMutableCounterLong newCounter(String name, String description, long initValue)
name
- of the metricdescription
- of the metricinitValue
- of the metric
public MetricMutableGaugeInt newGauge(String name, String description, int initValue)
name
- of the metricdescription
- of the metricinitValue
- of the metric
public MetricMutableGaugeLong newGauge(String name, String description, long initValue)
name
- of the metricdescription
- of the metricinitValue
- of the metric
public 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 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 MetricMutableStat newStat(String name)
name
- of the metric
public void incr(String name)
name
- of the metricpublic void incr(String name, MetricMutableFactory factory)
name
- of the metricfactory
- to lazily create the metric if not nullpublic void decr(String name)
name
- of the metricpublic void decr(String name, MetricMutableFactory factory)
name
- of the metricfactory
- to lazily create the metric if not nullpublic void add(String name, long value)
name
- of the metricvalue
- of the snapshot to addpublic void add(String name, long value, MetricMutableFactory factory)
name
- of the metricvalue
- of the snapshot to addfactory
- to lazily create the metric if not nullpublic MetricsRegistry setContext(String name)
name
- of the context
public MetricsRegistry tag(String name, String description, String value)
name
- of the tagdescription
- of the tagvalue
- of the tag
public MetricsRegistry tag(String name, String description, String value, boolean override)
name
- of the tagdescription
- of the tagvalue
- of the tagoverride
- existing tag if true
public Set<Map.Entry<String,MetricsTag>> tags()
public Set<Map.Entry<String,MetricMutable>> metrics()
public void snapshot(MetricsRecordBuilder builder, boolean all)
builder
- to contain the metrics snapshotall
- get all the metrics even if the values are not changed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |