AWS Cloudwatch Math Expressions: removing Insufficient Data: is there a “coalesce” function like SQL?

好久不见. 提交于 2021-01-29 09:39:48

问题


Can I replace a None/Insufficient data point as a value (constant is fine) in a Cloudwatch Math Expression?

I am using a math expression of several metrics: if's, arithmetic, etc.

The problem is that you are now bound by all of the variables having sufficient data. If one is missing a datapoint, WHAM! Insufficient data for that math expression.

Ideally, I'd like to do something like the following based on the standard SQL coalesce function:

coalsece(m1, m2, 15) + coalesce(m3, 25) / coalesce(m4, 8)

PLEASE NOTE: Cloudwatch's mechanism for handling Insufficient Data only covers the final value (the result of the math expression). I am looking to cover each individual value differently, allowing more than just is breaching/is ok/last value/insufficient data. Thus, the question linked here is an insufficient answer


回答1:


Two things:

  1. In general, you can perform math functions on > 1 variable, and they will apparently automatically fill in all gaps in the data with 0. However, if there is a simultaneous gap in the data, your output will be sparse.
  2. The better answer is the FILL() function. In the example above, every variable would need to make a specific call to FILL multiple times, as FILL only takes two arguments: a metric and either a time series to fill with OR a scalar value:
FILL(FILL(m1, m2), 15) + FILL(m3, 25) / FILL(m4, 8)

Ref: Cloudwatch function discription. Search for the FILL function.



来源:https://stackoverflow.com/questions/59494366/aws-cloudwatch-math-expressions-removing-insufficient-data-is-there-a-coalesc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!