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 Object
Builder for MetricOptions.
Since:
0.20
  • Constructor Details

    • Builder

      Builder()
  • Method Details

    • setDescription

      public abstract MetricOptions.Builder setDescription(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(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(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(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 Map<LabelKey,LabelValue> getConstantLabels()
    • getLabelKeys

      abstract List<LabelKey> getLabelKeys()
    • autoBuild

      abstract MetricOptions autoBuild()
    • build

      public MetricOptions build()
      Builds and returns a MetricOptions with the desired options.
      Returns:
      a MetricOptions with the desired options.
      Throws:
      NullPointerException - if description, OR unit is null, OR labelKeys is null OR any element of labelKeys is null, OR OR constantLabels is null OR any element of constantLabels is null.
      IllegalArgumentException - if any LabelKey from the labelKeys is in the constantLabels.
      Since:
      0.20