aws-cloudwatch expression attribute

127 Views Asked by At

Using aws-cloudwatch trigger with KEDA for auto scaling and not sure what the expression attribute is! Isn't supposed to return the value of the expected metrics/dimension at polling time? If yes, why do we still need other attributes like metricCollectionTime, metricStat, and metricStatPeriod?

1

There are 1 best solutions below

0
ELinda On BEST ANSWER

Option 1: Specify expression - The docs say that it's "Optional, Required when dimensionName & dimensionValue are not specified". However, it could say namespace, metricName, dimensionName, and dimensionValue. e.g.

 ...
 expression: SELECT AVG("my_metric_name") FROM "Metric/Namespace" WHERE dimension1 = "dimension1value"

Option 2: namespace, metricName, dimensionName, metricStat, and dimensionValue should be specified in place of expression.

e.g. The equivalent to the above would be:

 ...
 metricName: metric_name
 namespace: Metric/Namespace
 dimensionName: dimension1
 metricStat: Average
 dimensionValue: dimension1value

metricCollectionTime and metricStatPeriod are both needed regardless of which of the above two options is used, because they determine the time frame for which to look for metrics, whereas the above options have nothing to do with the timeframe associated to each metric.

  • metricCollectionTime is how far back to look for metrics
  • metricStatPeriod is how far back to aggregate metrics which are retrieved (must be less than or equal to metricCollectionTime). The aggregation function depends on metricStat or expression.