public class MetricsRegistry extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
CONTEXT_DESC
description for the context tag
|
static String |
CONTEXT_KEY
key for the context tag
|
| 构造器和说明 |
|---|
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
|
| 限定符和类型 | 方法和说明 |
|---|---|
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
|
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 metricspublic String name()
public MetricMutable get(String name)
name - of the metricpublic MetricMutableCounterInt newCounter(String name, String description, int initValue)
name - of the metricdescription - of the metricinitValue - of the metricpublic MetricMutableCounterLong newCounter(String name, String description, long initValue)
name - of the metricdescription - of the metricinitValue - of the metricpublic MetricMutableGaugeInt newGauge(String name, String description, int initValue)
name - of the metricdescription - of the metricinitValue - of the metricpublic MetricMutableGaugeLong newGauge(String name, String description, long initValue)
name - of the metricdescription - of the metricinitValue - of the metricpublic 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 metricpublic 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 contextpublic MetricsRegistry tag(String name, String description, String value)
name - of the tagdescription - of the tagvalue - of the tagpublic MetricsRegistry 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,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.Copyright © 2009 The Apache Software Foundation