Class: AWSCDK::CloudWatch::MetricProps

Inherits:
CommonMetricOptions
  • Object
show all
Defined in:
cloud_watch/metric_props.rb

Overview

Properties for a metric.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account: nil, color: nil, dimensions_map: nil, id: nil, label: nil, period: nil, region: nil, stack_account: nil, stack_region: nil, statistic: nil, unit: nil, visible: nil, metric_name:, namespace:) ⇒ MetricProps

Returns a new instance of MetricProps.

Parameters:

  • account (String, nil) (defaults to: nil)

    Account which this metric comes from.

  • color (String, nil) (defaults to: nil)

    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.

  • dimensions_map (Hash{String => String}, nil) (defaults to: nil)

    Dimensions of the metric.

  • id (String, nil) (defaults to: nil)

    Unique identifier for this metric when used in dashboard widgets.

  • label (String, nil) (defaults to: nil)

    Label for this metric when added to a Graph in a Dashboard.

  • period (AWSCDK::Duration, nil) (defaults to: nil)

    The period over which the specified statistic is applied.

  • region (String, nil) (defaults to: nil)

    Region which this metric comes from.

  • stack_account (String, nil) (defaults to: nil)

    Account of the stack this metric is attached to.

  • stack_region (String, nil) (defaults to: nil)

    Region of the stack this metric is attached to.

  • statistic (String, nil) (defaults to: nil)

    What function to use for aggregating.

  • unit (AWSCDK::CloudWatch::Unit, nil) (defaults to: nil)

    Unit used to filter the metric stream.

  • visible (Boolean, nil) (defaults to: nil)

    Whether this metric should be visible in dashboard graphs.

  • metric_name (String)

    Name of the metric.

  • namespace (String)

    Namespace of the metric.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'cloud_watch/metric_props.rb', line 21

def initialize(account: nil, color: nil, dimensions_map: nil, id: nil, label: nil, period: nil, region: nil, stack_account: nil, stack_region: nil, statistic: nil, unit: nil, visible: nil, metric_name:, namespace:)
  @account = 
  Jsii::Type.check_type(@account, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "account") unless @account.nil?
  @color = color
  Jsii::Type.check_type(@color, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "color") unless @color.nil?
  @dimensions_map = dimensions_map
  Jsii::Type.check_type(@dimensions_map, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "dimensionsMap") unless @dimensions_map.nil?
  @id = id
  Jsii::Type.check_type(@id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") unless @id.nil?
  @label = label
  Jsii::Type.check_type(@label, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "label") unless @label.nil?
  @period = period
  Jsii::Type.check_type(@period, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "period") unless @period.nil?
  @region = region
  Jsii::Type.check_type(@region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "region") unless @region.nil?
  @stack_account = 
  Jsii::Type.check_type(@stack_account, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stackAccount") unless @stack_account.nil?
  @stack_region = stack_region
  Jsii::Type.check_type(@stack_region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stackRegion") unless @stack_region.nil?
  @statistic = statistic
  Jsii::Type.check_type(@statistic, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "statistic") unless @statistic.nil?
  @unit = unit
  Jsii::Type.check_type(@unit, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5Vbml0In0=")), "unit") unless @unit.nil?
  @visible = visible
  Jsii::Type.check_type(@visible, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "visible") unless @visible.nil?
  @metric_name = metric_name
  Jsii::Type.check_type(@metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  @namespace = namespace
  Jsii::Type.check_type(@namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "namespace")
end

Instance Attribute Details

#accountString? (readonly)

Note:

Default: - Deployment account.

Account which this metric comes from.

Returns:

  • (String, nil)


56
57
58
# File 'cloud_watch/metric_props.rb', line 56

def 
  @account
end

#colorString? (readonly)

Note:

Default: - Automatic 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.

Returns:

  • (String, nil)


61
62
63
# File 'cloud_watch/metric_props.rb', line 61

def color
  @color
end

#dimensions_mapHash{String => String}? (readonly)

Note:

Default: - No dimensions.

Dimensions of the metric.

Returns:

  • (Hash{String => String}, nil)


66
67
68
# File 'cloud_watch/metric_props.rb', line 66

def dimensions_map
  @dimensions_map
end

#idString? (readonly)

Note:

Default: - No ID

Unique identifier for this metric when used in dashboard widgets.

The id can be used as a variable to represent this metric in math expressions. Valid characters are letters, numbers, and underscore. The first character must be a lowercase letter.

Returns:

  • (String, nil)


75
76
77
# File 'cloud_watch/metric_props.rb', line 75

def id
  @id
end

#labelString? (readonly)

Note:

Default: - No 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.

Returns:

  • (String, nil)


91
92
93
# File 'cloud_watch/metric_props.rb', line 91

def label
  @label
end

#metric_nameString (readonly)

Name of the metric.

Returns:

  • (String)


158
159
160
# File 'cloud_watch/metric_props.rb', line 158

def metric_name
  @metric_name
end

#namespaceString (readonly)

Namespace of the metric.

Returns:

  • (String)


162
163
164
# File 'cloud_watch/metric_props.rb', line 162

def namespace
  @namespace
end

#periodAWSCDK::Duration? (readonly)

Note:

Default: Duration.minutes(5)

The period over which the specified statistic is applied.

Returns:



96
97
98
# File 'cloud_watch/metric_props.rb', line 96

def period
  @period
end

#regionString? (readonly)

Note:

Default: - Deployment region.

Region which this metric comes from.

Returns:

  • (String, nil)


101
102
103
# File 'cloud_watch/metric_props.rb', line 101

def region
  @region
end

#stack_accountString? (readonly)

Note:

Default: - Deployment account.

Account of the stack this metric is attached to.

Returns:

  • (String, nil)


106
107
108
# File 'cloud_watch/metric_props.rb', line 106

def 
  @stack_account
end

#stack_regionString? (readonly)

Note:

Default: - Deployment region.

Region of the stack this metric is attached to.

Returns:

  • (String, nil)


111
112
113
# File 'cloud_watch/metric_props.rb', line 111

def stack_region
  @stack_region
end

#statisticString? (readonly)

Note:

Default: Average

What function to use for aggregating.

Use the aws_cloudwatch.Stats helper class to construct valid input strings.

Can be one of the following:

  • "Minimum" | "min"
  • "Maximum" | "max"
  • "Average" | "avg"
  • "Sum" | "sum"
  • "SampleCount | "n"
  • "pNN.NN"
  • "tmNN.NN" | "tm(NN.NN%:NN.NN%)"
  • "iqm"
  • "wmNN.NN" | "wm(NN.NN%:NN.NN%)"
  • "tcNN.NN" | "tc(NN.NN%:NN.NN%)"
  • "tsNN.NN" | "ts(NN.NN%:NN.NN%)"

Returns:

  • (String, nil)


132
133
134
# File 'cloud_watch/metric_props.rb', line 132

def statistic
  @statistic
end

#unitAWSCDK::CloudWatch::Unit? (readonly)

Note:

Default: - All metric datums in the given metric stream

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.

Returns:



146
147
148
# File 'cloud_watch/metric_props.rb', line 146

def unit
  @unit
end

#visibleBoolean? (readonly)

Note:

Default: true

Whether this metric should be visible in dashboard graphs.

Setting this to false is useful when you want to hide raw metrics that are used in math expressions, and show only the expression results.

Returns:

  • (Boolean, nil)


154
155
156
# File 'cloud_watch/metric_props.rb', line 154

def visible
  @visible
end

Class Method Details

.jsii_propertiesObject



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'cloud_watch/metric_props.rb', line 164

def self.jsii_properties
  {
    :account => "account",
    :color => "color",
    :dimensions_map => "dimensionsMap",
    :id => "id",
    :label => "label",
    :period => "period",
    :region => "region",
    :stack_account => "stackAccount",
    :stack_region => "stackRegion",
    :statistic => "statistic",
    :unit => "unit",
    :visible => "visible",
    :metric_name => "metricName",
    :namespace => "namespace",
  }
end

Instance Method Details

#to_jsiiObject



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'cloud_watch/metric_props.rb', line 183

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "account" => @account,
    "color" => @color,
    "dimensionsMap" => @dimensions_map,
    "id" => @id,
    "label" => @label,
    "period" => @period,
    "region" => @region,
    "stackAccount" => @stack_account,
    "stackRegion" => @stack_region,
    "statistic" => @statistic,
    "unit" => @unit,
    "visible" => @visible,
    "metricName" => @metric_name,
    "namespace" => @namespace,
  })
  result.compact
end