Ignore specific set of labels on prometheus query

Viewed 1195

I have a metric with 2 labels. Both labels can have 2 values A or B.

I'd like to sum all the values and exclude the case when Label1=A and Label2=B.

sum by (Label1,Label2)(metric{?})

Is it possible ?

1 Answers

Try the following query:

sum by (Label1,Label2) (metric unless metric{Label1="A",Label2="B"})
Related