Handling promql queries over fields with varied labels

433 views
Skip to first unread message

Chris Bonnell

unread,
May 4, 2017, 3:22:17 PM5/4/17
to Prometheus Users
I've looked through the backlog here and I can't find any questions that seem to match this one.

I'm trying to figure out if there's a way to aggregate fields with either different labels associated, or different sets of labels associated with them. If a query to, say, sum two different fields is executed and they don't precisely share labels, then nothing is found. I see the logic behind this behavior (so you can't, for example, add a gauge and a histogram), but I do wonder if it can be circumvented, and if so, how?

Does one need to implement relabeling rules manually for all such fields before attempting such an operation?

Thanks!
Chris



Julius Volz

unread,
May 4, 2017, 4:08:25 PM5/4/17
to Chris Bonnell, Prometheus Users
I'm not sure if I understand your question - by aggregation, I guess you don't mean the sum() aggregator, as that allows you to sum across series with wildly different label sets.

Are you talking about binary operations like "a + b"? In that case, vector matching modifiers will help: https://prometheus.io/docs/querying/operators/#vector-matching


--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/ca89caf4-8621-486c-a32a-7b29e8138f3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages