Hi Yongjik! Try using `quantile_over_time` instead of `quantile`. See https://prometheus.io/docs/prometheus/latest/querying/functions/#aggregation_over_time
On Fri, Feb 14, 2020 at 9:06 PM 'Yongjik Kim' via Prometheus Users < [email protected]> wrote: > Hi, > > I have a problem with aggregation. I want to get the CPU usage of a set of > jobs (each with potentially different start/stop time), over the past week, > and then get 95% percentile among these values. > > So, I can get the raw data points with this: > > > rate(cpu_usage{name="myjob"}[5m])[1d:5m] > > cpu_usage is an accumulative series (counter?) which records "the amount > of CPU resource this job has used since it started." So, as far as I > understand, this gives me a nice list of "average CPU usage for each > 5-minute interval, for every job and for every interval the job was alive." > > So far so good, but then how do I get the 95% percentile of *all these > values*? > > If I try this: > > > quantile(0.95, rate(cpu_usage{name="myjob"}[5m])[1d:5m]) > > I get: "Error executing query: invalid parameter 'query': parse error at > char 147: expected type instant vector in aggregation expression, got range > vector" > > I can make it output *some number* by removing [1d:5m], but that's not > what I want. I don't need 95% percentile at the current instant, but over > the past week. > > Any way to make it work without piping the result through a custom script? > > Thanks, > - Yongjik Kim > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-users/637d706d-e39a-4b0a-8ec3-70bdcc9c3cbc%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/637d706d-e39a-4b0a-8ec3-70bdcc9c3cbc%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Best Regards, Aliaksandr -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAPbKnmC7TAv2nLmc_sNWScYxy3SbaxWT4gq7B9QPv0b4a7DmzQ%40mail.gmail.com.

