问题
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:
- 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.
- The better answer is the
FILL()
function. In the example above, every variable would need to make a specific call toFILL
multiple times, asFILL
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