Need help in querying multiple metrics at the same time

36 views
Skip to first unread message

gokul krish

unread,
May 13, 2021, 2:52:17 PM5/13/21
to Prometheus Users

I want to run 100s of prometheus range vector queries with different metric names as well as different labels and value. I want to fetch the data for last one hour for all queries, at once

For example:

calls_per_min{account="se", service="serv1"}[1h] 
error_per_min{account="me", host="serv2"}[1h] 
resp_per_min{account="je", others="serv3"}[1h]

How can I combine these queries into one and get the result all at once? Is there a way to combine queries along with the label filters into one and fetch range vector for each of the queries at the same time

gokul krish

unread,
May 14, 2021, 7:11:42 AM5/14/21
to Prometheus Users
Can someone suggest if this is possible or not.

Matt Wilder

unread,
May 14, 2021, 7:31:11 PM5/14/21
to gokul krish, Prometheus Users
you have three options:

1) Issue the requests in parallel.  Provided the dataset size isn't too huge, and your prometheus instance has enough cpu/memory to handle the load, this could work

2) Use regexes on the vector names
{__name__=~"(calls|error|resp)_per_min, account=~"se|me|je", ...}

3) Some combination of the first 2

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5c77c5db-86e3-484d-aa67-4b687bee84d5n%40googlegroups.com.

This e-mail and all information in, attached to, or linked via this e-mail (together the ‘e-mail’) is confidential and may be legally privileged. It is intended solely for the intended addressee(s). Access to, or any onward transmission, of this e-mail by any other person is not authorised. If you are not the intended recipient, you are requested to immediately alert the sender of this e-mail and to immediately delete this e-mail. Any disclosure in any form of all or part of this e-mail, or of any the parties to it, including any copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. 


This e-mail is not, and is not intended to be, and should not be construed as being, (a) any offer, solicitation, or promotion of any kind; (b) the basis of any investment or other decision(s);  (c) any recommendation to buy, sell or transact in any manner any good(s), product(s) or service(s), nor engage in any investment(s) or other transaction(s) or activities;  or (d) the provision of, or related to, any advisory service(s) or activities, including regarding any investment, tax, legal, financial, accounting, consulting or any other related service(s).

Reply all
Reply to author
Forward
0 new messages