Reputation: 597
I want to make one http call to Prometheus server and get the following:
I have the following query which works, it requests the results of multiple prometheus metrics in one call for last 30 seconds. I`m just not sure how to extend this query to also calculate the rate for all these metrics. Can anyone help?
/api/v1/query?query={__name__=~"metric1|metric2|metric3",service=~"testservice"}[30s]
I want to do something like
/api/v1/query?query={rate(__name__=~"metric1|metric2|metric3",service=~"testservice"}[30s])
Upvotes: 4
Views: 4429
Reputation: 91
You need to put the rate
before the labels. This should work:
/api/v1/query?query=rate({__name__=~"metric1|metric2|metric3",service=~"testservice"}[30s])
Note that you must have at least one datapoint in the 30s period for each of the metrics.
Upvotes: 3