Prometheus : How to check if there is atleast one time series for a given metric and label combination?

1.3k Views Asked by At

I have metric, LATENCY and label, status. I want to fire an alert when LATENCY has status=CRITICAL

LATENCY{status="CRITICAL"}

LATENCY status will be critical only if latency is beyond a threshold. How to check if there is at least one time series with LATENCY{status="CRITICAL"} ?

I used expr: absent(LATENCY{status="CRITICAL"}) == 0, but it doesn't work.

2

There are 2 best solutions below

4
On BEST ANSWER

First you could try the following expression:

count(LATENCY{status="CRITICAL"}) > 0

If it doesn't work as expected, then try the following one:

count(LATENCY{status="CRITICAL"} or vector(0)) > 1
0
On

LATENCY{status="CRITICAL"} > bool 0