Class Metric.Builder

java.lang.Object
software.amazon.awscdk.services.cloudwatch.Metric.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<Metric>
Enclosing class:
Metric

@Stability(Stable) public static final class Metric.Builder extends Object implements software.amazon.jsii.Builder<Metric>
A fluent builder for Metric.
  • Method Details

    • create

      @Stability(Stable) public static Metric.Builder create()
      Returns:
      a new instance of Metric.Builder.
    • account

      @Stability(Stable) public Metric.Builder account(String account)
      Account which this metric comes from.

      Default: - Deployment account.

      Parameters:
      account - Account which this metric comes from. This parameter is required.
      Returns:
      this
    • color

      @Stability(Stable) public Metric.Builder color(String color)
      The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The Color class has a set of standard colors that can be used here.

      Default: - Automatic color

      Parameters:
      color - The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The Color class has a set of standard colors that can be used here. This parameter is required.
      Returns:
      this
    • dimensions

      @Stability(Deprecated) @Deprecated public Metric.Builder dimensions(Map<String,? extends Object> dimensions)
      Deprecated.
      Use 'dimensionsMap' instead.
      (deprecated) Dimensions of the metric.

      Default: - No dimensions.

      Parameters:
      dimensions - Dimensions of the metric. This parameter is required.
      Returns:
      this
    • dimensionsMap

      @Stability(Stable) public Metric.Builder dimensionsMap(Map<String,String> dimensionsMap)
      Dimensions of the metric.

      Default: - No dimensions.

      Parameters:
      dimensionsMap - Dimensions of the metric. This parameter is required.
      Returns:
      this
    • label

      @Stability(Stable) public Metric.Builder label(String label)
      Label for this metric when added to a Graph in a Dashboard.

      You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:

       [max: ${MAX}] MyMetric
       

      As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph's legend.

      Default: - No label

      Parameters:
      label - Label for this metric when added to a Graph in a Dashboard. This parameter is required.
      Returns:
      this
    • period

      @Stability(Stable) public Metric.Builder period(Duration period)
      The period over which the specified statistic is applied.

      Default: Duration.minutes(5)

      Parameters:
      period - The period over which the specified statistic is applied. This parameter is required.
      Returns:
      this
    • region

      @Stability(Stable) public Metric.Builder region(String region)
      Region which this metric comes from.

      Default: - Deployment region.

      Parameters:
      region - Region which this metric comes from. This parameter is required.
      Returns:
      this
    • statistic

      @Stability(Stable) public Metric.Builder statistic(String statistic)
      What function to use for aggregating.

      Can be one of the following:

      • "Minimum" | "min"
      • "Maximum" | "max"
      • "Average" | "avg"
      • "Sum" | "sum"
      • "SampleCount | "n"
      • "pNN.NN"

      Default: Average

      Parameters:
      statistic - What function to use for aggregating. This parameter is required.
      Returns:
      this
    • unit

      @Stability(Stable) public Metric.Builder unit(Unit unit)
      Unit used to filter the metric stream.

      Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units.

      The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases.

      CloudWatch does not honor this property for graphs.

      Default: - All metric datums in the given metric stream

      Parameters:
      unit - Unit used to filter the metric stream. This parameter is required.
      Returns:
      this
    • metricName

      @Stability(Stable) public Metric.Builder metricName(String metricName)
      Name of the metric.

      Parameters:
      metricName - Name of the metric. This parameter is required.
      Returns:
      this
    • namespace

      @Stability(Stable) public Metric.Builder namespace(String namespace)
      Namespace of the metric.

      Parameters:
      namespace - Namespace of the metric. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public Metric build()
      Specified by:
      build in interface software.amazon.jsii.Builder<Metric>
      Returns:
      a newly built instance of Metric.