How to handle NaN at Bosun?

I have 2 metrics and try to find the difference in the average between them as a percentage, like 100*(m1+m2)/m1 , but this obviously produces NaN if m1 goes to zero.

How should I handle this case if I do not want to warn when metrics go to zero?

+5
source share
1 answer

With bools, bosun has a short circuit like behavior. Since Bosun's expression language does not contain operators, you need to use the bool operation to see if the first divisor is the first:

 $foo = 0 $foo && 1/$foo 

Since $ foo is zero, the statement is not true, so 1 / $ foo is not taken into account in the final calculation:

enter image description here

+3
source

Source: https://habr.com/ru/post/1236502/


All Articles