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.

Reply via email to