@Public
@Evolving
public class MetricsRegistry
extends java.lang.Object
| Constructor | Description |
|---|---|
MetricsRegistry(java.lang.String name) |
Construct the registry with a record name
|
MetricsRegistry(MetricsInfo info) |
Construct the registry with a metadata object
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
add(java.lang.String name,
long value) |
Add sample to a stat metric by name.
|
MutableMetric |
get(java.lang.String name) |
Get a metric by name
|
MetricsTag |
getTag(java.lang.String name) |
Get a tag by name
|
MetricsInfo |
info() |
|
MutableCounterInt |
newCounter(java.lang.String name,
java.lang.String desc,
int iVal) |
Create a mutable integer counter
|
MutableCounterLong |
newCounter(java.lang.String name,
java.lang.String desc,
long iVal) |
Create a mutable long integer counter
|
MutableCounterInt |
newCounter(MetricsInfo info,
int iVal) |
Create a mutable integer counter
|
MutableCounterLong |
newCounter(MetricsInfo info,
long iVal) |
Create a mutable long integer counter
|
MutableGaugeFloat |
newGauge(java.lang.String name,
java.lang.String desc,
float iVal) |
Create a mutable float gauge
|
MutableGaugeInt |
newGauge(java.lang.String name,
java.lang.String desc,
int iVal) |
Create a mutable integer gauge
|
MutableGaugeLong |
newGauge(java.lang.String name,
java.lang.String desc,
long iVal) |
Create a mutable long integer gauge
|
MutableGaugeFloat |
newGauge(MetricsInfo info,
float iVal) |
Create a mutable float gauge
|
MutableGaugeInt |
newGauge(MetricsInfo info,
int iVal) |
Create a mutable integer gauge
|
MutableGaugeLong |
newGauge(MetricsInfo info,
long iVal) |
Create a mutable long integer gauge
|
MutableQuantiles |
newInverseQuantiles(java.lang.String name,
java.lang.String desc,
java.lang.String sampleName,
java.lang.String valueName,
int interval) |
Create a mutable inverse metric that estimates inverse quantiles of a stream of values
|
MutableRollingAverages |
newMutableRollingAverages(java.lang.String name,
java.lang.String valueName) |
|
MutableQuantiles |
newQuantiles(java.lang.String name,
java.lang.String desc,
java.lang.String sampleName,
java.lang.String valueName,
int interval) |
Create a mutable metric that estimates quantiles of a stream of values
|
MutableRate |
newRate(java.lang.String name) |
Create a mutable rate metric
|
MutableRate |
newRate(java.lang.String name,
java.lang.String description) |
Create a mutable rate metric
|
MutableRate |
newRate(java.lang.String name,
java.lang.String desc,
boolean extended) |
Create a mutable rate metric (for throughput measurement).
|
MutableRate |
newRate(java.lang.String name,
java.lang.String desc,
boolean extended,
boolean returnExisting) |
|
MutableRatesWithAggregation |
newRatesWithAggregation(java.lang.String name) |
|
MutableStat |
newStat(java.lang.String name,
java.lang.String desc,
java.lang.String sampleName,
java.lang.String valueName) |
Create a mutable metric with stats
|
MutableStat |
newStat(java.lang.String name,
java.lang.String desc,
java.lang.String sampleName,
java.lang.String valueName,
boolean extended) |
Create a mutable metric with stats
|
MetricsRegistry |
setContext(java.lang.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(java.lang.String name,
java.lang.String description,
java.lang.String value) |
Add a tag to the metrics
|
MetricsRegistry |
tag(java.lang.String name,
java.lang.String description,
java.lang.String value,
boolean override) |
Add a tag to the metrics
|
MetricsRegistry |
tag(MetricsInfo info,
java.lang.String value) |
|
MetricsRegistry |
tag(MetricsInfo info,
java.lang.String value,
boolean override) |
Add a tag to the metrics
|
java.lang.String |
toString() |
public MetricsRegistry(java.lang.String name)
name - of the record of the metricspublic MetricsRegistry(MetricsInfo info)
info - the info object for the metrics record/grouppublic MetricsInfo info()
public MutableMetric get(java.lang.String name)
name - of the metricpublic MetricsTag getTag(java.lang.String name)
name - of the tagpublic MutableCounterInt newCounter(java.lang.String name, java.lang.String desc, int iVal)
name - of the metricdesc - metric descriptioniVal - initial valuepublic MutableCounterInt newCounter(MetricsInfo info, int iVal)
info - metadata of the metriciVal - initial valuepublic MutableCounterLong newCounter(java.lang.String name, java.lang.String desc, long iVal)
name - of the metricdesc - metric descriptioniVal - initial valuepublic MutableCounterLong newCounter(MetricsInfo info, long iVal)
info - metadata of the metriciVal - initial valuepublic MutableGaugeInt newGauge(java.lang.String name, java.lang.String desc, int iVal)
name - of the metricdesc - metric descriptioniVal - initial valuepublic MutableGaugeInt newGauge(MetricsInfo info, int iVal)
info - metadata of the metriciVal - initial valuepublic MutableGaugeLong newGauge(java.lang.String name, java.lang.String desc, long iVal)
name - of the metricdesc - metric descriptioniVal - initial valuepublic MutableGaugeLong newGauge(MetricsInfo info, long iVal)
info - metadata of the metriciVal - initial valuepublic MutableGaugeFloat newGauge(java.lang.String name, java.lang.String desc, float iVal)
name - of the metricdesc - metric descriptioniVal - initial valuepublic MutableGaugeFloat newGauge(MetricsInfo info, float iVal)
info - metadata of the metriciVal - initial valuepublic MutableQuantiles newQuantiles(java.lang.String name, java.lang.String desc, java.lang.String sampleName, java.lang.String valueName, int interval)
name - of the metricdesc - metric descriptionsampleName - of the metric (e.g., "Ops")valueName - of the metric (e.g., "Time" or "Latency")interval - rollover interval of estimator in secondsMetricsException - if interval is not a positive integerpublic MutableQuantiles newInverseQuantiles(java.lang.String name, java.lang.String desc, java.lang.String sampleName, java.lang.String valueName, int interval)
name - of the metricdesc - metric descriptionsampleName - of the metric (e.g., "Ops")valueName - of the metric (e.g., "Rate")interval - rollover interval of estimator in secondsMetricsException - if interval is not a positive integerpublic MutableStat newStat(java.lang.String name, java.lang.String desc, java.lang.String sampleName, java.lang.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 MutableStat newStat(java.lang.String name, java.lang.String desc, java.lang.String sampleName, java.lang.String valueName)
name - of the metricdesc - metric descriptionsampleName - of the metric (e.g., "Ops")valueName - of the metric (e.g., "Time" or "Latency")public MutableRate newRate(java.lang.String name)
name - of the metricpublic MutableRate newRate(java.lang.String name, java.lang.String description)
name - of the metricdescription - of the metricpublic MutableRate newRate(java.lang.String name, java.lang.String desc, boolean extended)
name - of the metricdesc - descriptionextended - produce extended stat (stdev/min/max etc.) if true@Private public MutableRate newRate(java.lang.String name, java.lang.String desc, boolean extended, boolean returnExisting)
public MutableRatesWithAggregation newRatesWithAggregation(java.lang.String name)
public MutableRollingAverages newMutableRollingAverages(java.lang.String name, java.lang.String valueName)
public void add(java.lang.String name,
long value)
name - of the metricvalue - of the snapshot to addpublic MetricsRegistry setContext(java.lang.String name)
name - of the contextpublic MetricsRegistry tag(java.lang.String name, java.lang.String description, java.lang.String value)
name - of the tagdescription - of the tagvalue - of the tagpublic MetricsRegistry tag(java.lang.String name, java.lang.String description, java.lang.String value, boolean override)
name - of the tagdescription - of the tagvalue - of the tagoverride - existing tag if truepublic MetricsRegistry tag(MetricsInfo info, java.lang.String value, boolean override)
info - metadata of the tagvalue - of the tagoverride - existing tag if truepublic MetricsRegistry tag(MetricsInfo info, java.lang.String value)
public void snapshot(MetricsRecordBuilder builder, boolean all)
builder - to contain the metrics snapshotall - get all the metrics even if the values are not changed.public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2008–2025 Apache Software Foundation. All rights reserved.