When I use the "reduce" expression, I receive two values and I want to exclude one

I’m using this simple alert:

But instead of receiving the “A” value, I’m receveing the A and B values, this:

I wan’t to exclude the B value because is pointless, how can I do this?

Thanks!

Hi! If you want to exclude the B value (i.e. 11788) then you can replace your range over $values with something like:

{{ if $values.C }}{{ $labels.source }}: {{ $values.C }}{{ end }}

1 Like

Great! Thank you, this worked :smiley:

I have another, maybe stupid, request… it’s off topic so you can avoid to reply, but maybe it’s super easy and I’m stupid, but I can’t figure out :thinking:

Always regarding the same alert

I want to get only the latests 5 minutes of the Prometheus queries but if I select last_over_time [5m] I get the same exactly number of queries if I get when I use [24h], or whatever time range.

sum by(source) (last_over_time(pihole_top_sources[5m]))

I don’t know, maybe the culprit is the Prometheus exporter that writes only the 24h total number of queries, or I’m doing something else wrong?

Not a big deal, I can use the 24h data but I’m curious to understand why the time range is not used/captured!

Thanks again