4

Prometheus最佳实践-聚合函数

 1 year ago
source link: https://qingwave.github.io/prometheus-best-practice-operation/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Jul 16, 2020 · cloud

Prometheus最佳实践-聚合函数



prometheus 中rate只能用于counter类型,对于需要聚合的数据需要先ratesum,而不是rate(sum)

数据准确性

rate/increase/delta等操作对于原始值进行了外推(类似线性插件),得到的不是准确值

rate(http_requests_total[2m])指两分钟内每秒平均请求量,通过2m内首尾两个数据外推得到差值,比 120s 得到; 同理increase(http_requests_total[2m])指的不是首尾两个值的增长量,而是外推后计算出2m内的增长量。

absent

通常报警中,我们需要对某个对象是不是有数据进行监控(即nodata监控),absent用来验证指标是不是有数据很有用

predict_linear

线性回归预测,适合线性数据的预测,如预测 etcd 的未来 4 小时文件描述符使用量

predict_linear(cluster:etcd:fd_utilization[1h], 3600 * 4)

quantile_over_time

一段时间内统计分位数

quantile_over_time(0.9, http_requests_total[1d]) # 一天内请求量的90分位

某些情况的需要比较两个标量(通常用来报警),可以使用 bool

http_requests_total > bool 100

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK