I have 2 metrics and try to find the difference of average value between them in percentage like 100*(m1+m2)/m1
but this obviously produces NaN
if m1
turns to zero.
How should I handle this case if I don't want to alert when the metrics turn to zero?
With bools bosun has a short-circuit like behavior. Since Bosun's expression language lacks if statements, you need to use a bool operation to see if the divisor is 0 first:
$foo = 0
$foo && 1/$foo
Since $foo is zero, the statement is "not true" so 1/$foo is not factored into the final calculation:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With