Package io.opencensus.metrics
Class MetricOptions.Builder
- java.lang.Object
-
- io.opencensus.metrics.MetricOptions.Builder
-
- Direct Known Subclasses:
AutoValue_MetricOptions.Builder
- Enclosing class:
- MetricOptions
public abstract static class MetricOptions.Builder extends java.lang.Object
Builder forMetricOptions
.- Since:
- 0.20
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract MetricOptions
autoBuild()
MetricOptions
build()
Builds and returns aMetricOptions
with the desired options.(package private) abstract java.util.Map<LabelKey,LabelValue>
getConstantLabels()
(package private) abstract java.util.List<LabelKey>
getLabelKeys()
abstract MetricOptions.Builder
setConstantLabels(java.util.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(java.lang.String description)
Sets the description of the Metric.abstract MetricOptions.Builder
setLabelKeys(java.util.List<LabelKey> labelKeys)
Sets the list of label keys for the Metric.abstract MetricOptions.Builder
setUnit(java.lang.String unit)
Sets the unit of the Metric.
-
-
-
Method Detail
-
setDescription
public abstract MetricOptions.Builder setDescription(java.lang.String description)
Sets the description of the Metric.- Parameters:
description
- the description of the Metric.- Returns:
- this.
- Since:
- 0.20
-
setUnit
public abstract MetricOptions.Builder setUnit(java.lang.String unit)
Sets the unit of the Metric.- Parameters:
unit
- the unit of the Metric.- Returns:
- this.
- Since:
- 0.20
-
setLabelKeys
public abstract MetricOptions.Builder setLabelKeys(java.util.List<LabelKey> labelKeys)
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
public abstract MetricOptions.Builder setConstantLabels(java.util.Map<LabelKey,LabelValue> constantLabels)
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
abstract java.util.Map<LabelKey,LabelValue> getConstantLabels()
-
getLabelKeys
abstract java.util.List<LabelKey> getLabelKeys()
-
autoBuild
abstract MetricOptions autoBuild()
-
build
public MetricOptions build()
Builds and returns aMetricOptions
with the desired options.- Returns:
- a
MetricOptions
with the desired options. - Throws:
java.lang.NullPointerException
- ifdescription
, ORunit
is null, ORlabelKeys
is null OR any element oflabelKeys
is null, OR ORconstantLabels
is null OR any element ofconstantLabels
is null.java.lang.IllegalArgumentException
- if anyLabelKey
from thelabelKeys
is in theconstantLabels
.- Since:
- 0.20
-
-