Search code examples
prometheuspromql

Aggregating labels between timeseries


I have metrics that look like this:

myMetric{client="A",server="1",otherlabel="W"} 10
myMetric{client="A",server="2",otherlabel="X"} 21
myMetric{client="B",server="1",otherlabel="Y"} 32
myMetric{client="B",server="4",otherlabel="Z"} 43

I'm trying to find this data:

myMetric{client="A",servers="1,2"} 31
myMetric{client="B",servers="1,4"} 75

Is this even possible? The data's there, I just can't figure out how to write the query.


Solution

  • That's not possible, however:

    sum without(server, otherLabel)(myMetric)
    

    will give you that with just the client label.