@InterfaceAudience.Public @InterfaceStability.Evolving public class MetricStringBuilder extends MetricsRecordBuilder
toString()
operator dumps out all values collected.
Every entry is formatted as
prefix + name + separator + value + suffix
Constructor and Description |
---|
MetricStringBuilder(MetricsCollector parent,
String prefix,
String separator,
String suffix)
Build an instance.
|
Modifier and Type | Method and Description |
---|---|
MetricsRecordBuilder |
add(AbstractMetric metric)
Add a pre-made immutable metric object
|
MetricStringBuilder |
add(MetricsInfo info,
Object value) |
MetricsRecordBuilder |
add(MetricsTag tag)
Add an immutable metrics tag object
|
MetricsRecordBuilder |
addCounter(MetricsInfo info,
int value)
Add an integer metric
|
MetricsRecordBuilder |
addCounter(MetricsInfo info,
long value)
Add an long metric
|
MetricsRecordBuilder |
addGauge(MetricsInfo info,
double value)
Add a double gauge metric
|
MetricsRecordBuilder |
addGauge(MetricsInfo info,
float value)
Add a float gauge metric
|
MetricsRecordBuilder |
addGauge(MetricsInfo info,
int value)
Add a integer gauge metric
|
MetricsRecordBuilder |
addGauge(MetricsInfo info,
long value)
Add a long gauge metric
|
MetricsCollector |
parent() |
MetricsRecordBuilder |
setContext(String value)
Set the context tag
|
MetricsRecordBuilder |
tag(MetricsInfo info,
String value)
Add a metrics tag
|
String |
toString() |
MetricStringBuilder |
tuple(String key,
String value)
Add any key,val pair to the string, between the prefix and suffix,
separated by the separator.
|
endRecord
public MetricStringBuilder(MetricsCollector parent, String prefix, String separator, String suffix)
parent
- parent collector. Unused in this instance; only used for
the parent()
methodprefix
- string before each entryseparator
- separator between name and valuesuffix
- suffix after each entrypublic MetricStringBuilder add(MetricsInfo info, Object value)
public MetricStringBuilder tuple(String key, String value)
key
- keyvalue
- valuepublic MetricsRecordBuilder tag(MetricsInfo info, String value)
MetricsRecordBuilder
tag
in class MetricsRecordBuilder
info
- metadata of the tagvalue
- of the tagpublic MetricsRecordBuilder add(MetricsTag tag)
MetricsRecordBuilder
add
in class MetricsRecordBuilder
tag
- a pre-made tag object (potentially save an object construction)public MetricsRecordBuilder add(AbstractMetric metric)
MetricsRecordBuilder
add
in class MetricsRecordBuilder
metric
- the pre-made metric to save an object constructionpublic MetricsRecordBuilder setContext(String value)
MetricsRecordBuilder
setContext
in class MetricsRecordBuilder
value
- of the contextpublic MetricsRecordBuilder addCounter(MetricsInfo info, int value)
MetricsRecordBuilder
addCounter
in class MetricsRecordBuilder
info
- metadata of the metricvalue
- of the metricpublic MetricsRecordBuilder addCounter(MetricsInfo info, long value)
MetricsRecordBuilder
addCounter
in class MetricsRecordBuilder
info
- metadata of the metricvalue
- of the metricpublic MetricsRecordBuilder addGauge(MetricsInfo info, int value)
MetricsRecordBuilder
addGauge
in class MetricsRecordBuilder
info
- metadata of the metricvalue
- of the metricpublic MetricsRecordBuilder addGauge(MetricsInfo info, long value)
MetricsRecordBuilder
addGauge
in class MetricsRecordBuilder
info
- metadata of the metricvalue
- of the metricpublic MetricsRecordBuilder addGauge(MetricsInfo info, float value)
MetricsRecordBuilder
addGauge
in class MetricsRecordBuilder
info
- metadata of the metricvalue
- of the metricpublic MetricsRecordBuilder addGauge(MetricsInfo info, double value)
MetricsRecordBuilder
addGauge
in class MetricsRecordBuilder
info
- metadata of the metricvalue
- of the metricpublic MetricsCollector parent()
parent
in class MetricsRecordBuilder
Copyright © 2017 Apache Software Foundation. All rights reserved.