Package io.opencensus.metrics
Class MetricOptions.Builder
java.lang.Object
io.opencensus.metrics.MetricOptions.Builder
- Direct Known Subclasses:
AutoValue_MetricOptions.Builder
- Enclosing class:
MetricOptions
Builder for
MetricOptions
.- Since:
- 0.20
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) abstract MetricOptions
build()
Builds and returns aMetricOptions
with the desired options.(package private) abstract Map
<LabelKey, LabelValue> abstract MetricOptions.Builder
setConstantLabels
(Map<LabelKey, LabelValue> constantLabels) Sets the map of constant labels (they will be added to all the TimeSeries) for the Metric.abstract MetricOptions.Builder
setDescription
(String description) Sets the description of the Metric.abstract MetricOptions.Builder
setLabelKeys
(List<LabelKey> labelKeys) Sets the list of label keys for the Metric.abstract MetricOptions.Builder
Sets the unit of the Metric.
-
Constructor Details
-
Builder
Builder()
-
-
Method Details
-
setDescription
Sets the description of the Metric.- Parameters:
description
- the description of the Metric.- Returns:
- this.
- Since:
- 0.20
-
setUnit
Sets the unit of the Metric.- Parameters:
unit
- the unit of the Metric.- Returns:
- this.
- Since:
- 0.20
-
setLabelKeys
Sets the list of label keys for the Metric.- Parameters:
labelKeys
- the list of label keys for the Metric.- Returns:
- this.
- Since:
- 0.20
-
setConstantLabels
Sets the map of constant labels (they will be added to all the TimeSeries) for the Metric.- Parameters:
constantLabels
- the map of constant labels for the Metric.- Returns:
- this.
- Since:
- 0.21
-
getConstantLabels
-
getLabelKeys
-
autoBuild
-
build
Builds and returns aMetricOptions
with the desired options.- Returns:
- a
MetricOptions
with the desired options. - Throws:
NullPointerException
- ifdescription
, ORunit
is null, ORlabelKeys
is null OR any element oflabelKeys
is null, OR ORconstantLabels
is null OR any element ofconstantLabels
is null.IllegalArgumentException
- if anyLabelKey
from thelabelKeys
is in theconstantLabels
.- Since:
- 0.20
-