PromQL 从入门到精通
http_request_duration_seconds_bucket{job="n9e-proxy", le="0.1"} 500 http_request_duration_seconds_bucket{job="n9e-proxy", le="1"} 700 http_request_duration_seconds_bucket{job="n9e-proxy", le="10"} 850 htt http_request_duration_seconds_bucket{job="n9e-proxy", le="20"} 1000 http_request_duration_seconds_bucket{job="n9e-proxy", le="+Inf"} 1000 根据这个数据,我们可以计算出落在各个延迟区间的请求数量,如下: 0 ~ 0.1 : 500 0.1 ~ 1 : 200 ,我们可能希望以模块为颗粒度,分别计算每 个模块的90分位延迟,写法是: histogram_quantile( 0.9, sum by (job, le) (rate(http_request_duration_seconds_bucket[10m])) ) 注意,这里通过job标签来区分模块,le是计算histogram_quantile必须的,所以也要放到sum by后面,如果我们要计算全部数据的0 码力 | 16 页 | 2.77 MB | 1 年前3Intro to Prometheus - With a dash of operations & observability
temperature_celsius WHERE \ country=" germany" GROUP BY city rate(errors{job=" foo" }[5m]) / rate(total{job=" foo" }[5m]) SELECT errors.job, errors.instance, [...more labels...], \ rate(errors.value, 5m) / rate(total rate(total.value, 5m) \ FROM errors JOIN total ON [...all label equalities...] \ WHERE errors.job=" foo" AND total.job=" foo" Richard Hartmann & Frederic Branczyk @TwitchiH & @fredbrancz Intro to Prometheus0 码力 | 19 页 | 63.73 KB | 1 年前3OpenMetrics - Standing on the shoulders of Titans
Quick intro OpenMetrics Outro Thanks! Thanks for listening! Questions? Email me if you want a job in Munich. See slide footer for contact info. Richard Hartmann, RichiH@{freenode,OFTC,IRCnet}, richih@{fosdem0 码力 | 21 页 | 84.83 KB | 1 年前3
共 3 条
- 1