Hi guys,

Grafana version: 8.4.3 (self-hosted)

Alerting: Unified alerting

Datasource: Prometheus:

What I’m trying to achieve is to detect (based on Prometheus data serie for my 3 queues) if one of them (or more) and which one(s) have no data for last 30 minutes.

Data is collected by Prometheus every 5 minutes.

So, I have 3 queries defined for an alert:

A: queue_count{queue=“pull”, status=~“E|F”}

B: queue_count{queue=“in”, status=~“E|F”}

C: queue_count{queue=“out”, status=~“E|F”}

Then I have 3 reduce expressions (Reduce, Sum)

D reduces A

E reduces B

F reduces C

According to Grafana’s documentation for Reduce used with Sum function:

“Sum returns the total of all values in the series. If series is of zero length, the sum will be 0”.

So my understanding is this one should return 0 if there are no series (no data). Or not ?

Asking because above returns “no data”.

Now I’m trying to create math expression (G) to trigger alert as described above.

Is it possible this way ? Or any way ?

Or maybe I need to take another approach ?

EDIT: Looks like it’s also related to : “how to return metric value 0 when this metric returns ‘no data’”.I know i can add OR on() vector(0) but this one removes labels from result…Any advices ?

Thanks in advance !

Ged