简体   繁体   中英

Prometheus Query Overall average under a time interval

How can I find the overall average of metrics over time interval ?

avg(metric) = overall average value but

avg_over_time(metrics[interval]) = averages value per label

avg( avg_over_time(metric[scrape interval]) ) won't be same as (when the data is not continuous and denominator value is different) avg(metric) !!!!

Given a scenario, what will be the possible way to find the overall average over a time period.

Eg: Find the average response time now and Find the average response time(over all) of all the request triggered in last one hour.

The number will be helpful to notify a performance issue with latest upgrades.

You need to calculate the average a bit more manually:

    sum(sum_over_time(metric[interval]))
/
    sum(count_over_time(metric[interval]))

Note that this is for data in a gauge, you'd need a different approach for data from a counter or summary.

请帮我解决这个指标 avg( avg_over_time((sum without ()(kube_pod_status_ready{namespace="monitoring",pod="prometheus-prometheus-operator-prometheus-0",condition="true"}) / count没有 ()(kube_pod_status_ready{namespace="monitoring",pod="prometheus-prometheus-operator-prometheus-0"}))[$duration:5m]) .. 这个指标不能显示数据(不适用)

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