Fix WO fallback-rate alarm math expression (deploy hotfix) (#102)
Some checks are pending
Deploy / deploy (push) Waiting to run

The EmailProcessorTemplateFallbackRateAlarm added in #99 used
MAX([FILL(fb,0)+FILL(tmpl,0),1]) as a divide-by-zero guard, but
CloudWatch metric math has no element-wise MAX over an array; it
rejects the array operand at deploy time with 'Unsupported operand
type(s) for MAX', failing the WorkorderIngestStack update (it rolled
back cleanly). The outer IF((...)>=10, ...) volume floor already
guarantees a non-zero denominator in the true branch, so divide by
(FILL(fb,0)+FILL(tmpl,0)) directly and drop the invalid guard.

Unblocks the #99 deploy (PO stack already applied; WO rolled back).
This commit is contained in:
Adam Moussa 2026-07-16 12:56:16 -04:00 • committed by GitHub
parent acc1961d21
commit 8e16d34dc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -418,8 +418,12 @@ class WorkorderIngestStack(Stack):
)
fallback_rate = cloudwatch.MathExpression(
expression=(
# The IF volume floor (>=10) already guarantees the denominator
# is non-zero in the true branch, so divide directly. (An earlier
# MAX([...,1]) divide-by-zero guard used array syntax CloudWatch
# rejects at deploy: "Unsupported operand type(s) for MAX".)
"IF((FILL(fb,0)+FILL(tmpl,0))>=10, "
"100*FILL(fb,0)/MAX([FILL(fb,0)+FILL(tmpl,0),1]), 0)"
"100*FILL(fb,0)/(FILL(fb,0)+FILL(tmpl,0)), 0)"
),
using_metrics={"fb": fb_metric, "tmpl": tmpl_metric},
period=Duration.minutes(15),