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])
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With