Can I preserve labels from promql query with aggregations?

94 views Asked by At

I have a query like:

sum by (city) (probe_success{job=~"dns.*"})

which returns the values ​​of successful samples grouped by city. It`s OK, but I need to create vmalert rules with the next idea:

  1. If 1 city "down" -> alert severity low
  2. If 2 city "down" -> alert severity medium
  3. If 3 city "down" -> alert severity critical I know, what I can to set rule like this:
count((sum by (city) (probe_success{job=~"dns.*"}) == 0)) == 2

But this query doesn`t contains labels. A better solution would be if the query also returned a set of labels city1 city2. Can I preserve labels from aggregated promql vectors? I use VM by the way, I know it has extended query options

0

There are 0 answers