Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there any way of returning a 0 or 1(boolean) on the basis of a value of a time series metric in Prometheus?

is there any way to return a boolean value when a time series that has a threshold of 2s is crossed, The metric is usually 0, but if a threshold of 2 is crossed, the return should be a 1?

like image 316
DiasporaUnknown Avatar asked Nov 30 '25 06:11

DiasporaUnknown


1 Answers

You need to use bool modifier together with comparison operator. For example, the following query returns 0 when m is less than 2, while returning 1 when m equals or greater than 2:

m >=bool 2
like image 59
valyala Avatar answered Dec 02 '25 05:12

valyala



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!