Relative Content

Tag Archive for prometheuspromql

Aggregating over multiple series and time in Prometheus PromQL

I have some data I am querying from Prometheus, a range vector, that I am currently getting via sum by (label1, label2) (series_name), and as expected, it gives me the most recent results of the sums by the labels. I am trying to change it to get the results over a timeframe (let’s say 1 minute with a resolution of 5 seconds).

How to filter a time series after applying aggregation in PromQL?

I have a promQL expression like this- sum(metric_1) by (label_1). Now, I want to filter out the output of the expression using another label label_2. Something like this- (sum(metric_1) by (label_1)){label_2="some_value"}. But, this is not working and is giving a parse error. How can I achieve this?