简体   繁体   中英

How to sum difference in time between two metrics over last 30 days in PromQL

I am trying to compile some stats over last 30 days of metrics. I want to sum the diffence over time of kube_job_status_completion_time and kube_job_status_start_time

sum(max_over_time(kube_job_status_completion_time[30d] - kube_job_status_start_time[30d]))

I get the following error

Error executing query: invalid parameter 'query': parse error at char 86: binary expression must contain only scalar and instant vector types.

Any suggestion on how I should proceed?

My goal is to plot an instant bar graph in grafana showing last 30 days sum of computation time for every namespace.

thanks

我想我明白了

sum(max_over_time(kube_job_status_completion_time[30d]) - min_over_time(kube_job_status_start_time[30d])) by (namespace)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM