翻译:Irate绘图更精准

article/2025/9/29 7:22:51

原文:Irate graphs are better graphs | Robust Perception

Prometheus 0.16.1 was just released, and with it brings my addition of the irate function. This offers more responsive graphs and higher resolution dashboards.
刚刚发布的普罗米修斯 0.16.1,新增了irate函数。它提供更好的响应界面(responsive graphs)和更高分辨率的面板(dashboards)。


CPU usage on a machine. Red: irate(x[5m]). Green: rate(x[5m]).
电脑CPU使用率。红线:irate(x[5m])。绿线:rate(x[5m])。

The rate function takes a time series over a time range, and based on the first and last data points within that range (allowing for counter resets) calculates a per-second rate. As it’s based on the whole range, it’s effectively an average rate over that range – 5 minutes in this case. You can see that the green line in the graph above is slow to pick up on changes, and not showing the full detail.

rate函数在一个时间范围内构建时间序列,基于设定范围内的第一个和最后一个数据点来计算每秒比率(允许计数器重置),(last值-first值)/时间差。因为它是基于范围的,实际上它是某个范围的平均值 - 在本例是5分钟。在上图中,你可以看到绿线对数据的变化响应慢,而且没有显示详情。

By contrast irate is an instant rate. It only looks at the last two points within the range passed to it and calculates a per-second rate. In the graph above the scrape interval is 10 seconds, so the red line is allowing you to see much briefer spikes and finer detail. This gives you better insight into what’s really going on, taking advantage of the full resolution of the data available.

相比之下,irate是一个瞬时比率。 它只观测设定的范围内的最后两个点,并计算每秒的速率,(last值-last前一个值)/时间戳差值。在上图中,拉取间隔为10秒,那么红线看到更多的峰值和更详细的细节。这让你更好地了解实际情况,充分利用数据的全分辨率。

As with rate, irate is resilient to scrapes failing as it’ll look back to the previous successful scrape. This loses a little resolution, but you don’t miss any sudden changes around that failed scrape. This is one advantage of exporting raw counters over rates computed on the instrumented system.

和rate一样,irate碰到拉取数据失败是会取之前成功的数据。这样会损失一些精度,但是你不会错过那些失败的拉取数据。这是将原始计数器导出到在仪表化系统上计算的比率的一个优点。

Due to the instant rate being more responsive, there are a few things you should be aware of. If you’re doing alerting based on irate a very brief dip could reset the alert’s FOR clause, so prefer rate for alerting. In graphs over long time periods used for trending, full resolution data can be distracting so the implicit averaging of rate is more useful.

由于即时响应(instant rate)比较灵敏,你应该注意以下几点。如果基于irate配置告警,非常短暂的下降可能会使警报重设,因此最好使用rate作为告警条件。在用于长期趋势的图表中,完整的分辨率数据会分散注意力,所以隐式的平均比率更有用。

If irate only looks at the last two points, why do we pass it a much longer period than that? The answer is that you want to limit how far back it’ll look to find those two points, as you don’t want to inadvertently use data from hours ago. This also has the benefit that dashboards no longer need to consider all potential scrape intervals when choosing the rate range, often leading to averaging over a much longer period than is needed. With the instant rate if scrapes become more frequent, graphs automatically improve in resolution!

如果irate只需要最近两个点的数据,那为什么我们要传比这两个点长得多的时间范围呢?答案是,你想要限制这两点的取值范围,因为你不希望使用几个小时前的数据。还有另外一个好处,在面板(dashboards)选择比率范围(rate range)时,不需要考虑所有可能的拉取间隔(scrape intervals)。因为那样做通常会导致计算的时间比需要的长得多。如果拉取动作(scrape)变得更频繁,图像会自动提高分辨率。

转载于:https://my.oschina.net/u/2419022/blog/1154505


http://chatgpt.dhexx.cn/article/fy4CeeVt.shtml

相关文章

prometheus-rate、irate、increase函数使用场景

rate() rate(v range-vector)计算范围向量中时间序列的每秒平均平均增长率。单调性中断(例如由于目标重启而导致的计数器重置)会自动进行调整。同样,计算会外推到时间范围的末尾,从而允许遗漏刮擦或刮擦周期与该范围的时间段不完…

Prometheus监控 rate与irate的区别

对官网文档的解读irate和rate都会用于计算某个指标在一定时间间隔内的变化速率。但是它们的计算方法有所不同:irate取的是在指定时间范围内的最近两个数据点来算速率,而rate会取指定时间范围内所有数据点,算出一组速率,然后取平均…

Prometheus中 rate、irate、increase函数的使用场景

首先给出Prometheus的文档,建议先了解一下 官方文档 以及本文的参考文档: 参考文档 rate() rate(v range-vector)计算范围向量中时间序列的每秒平均平均增长率。单调性中断(例如由于目标重启而导致的计数器重置)会自动进行调整。…

PromQL 计算Counter指标增长率 rate irate increase

我们知道Counter类型的监控指标其特点是只增不减,在没有发生重置(如服务器重启,应用重启)的情况下其样本值应该是不断增大的。为了能够更直观的表示样本数据的变化剧烈情况,需要计算样本的增长速率。 如下图所示&…

PromQL 平均增长率 rate 函数 瞬时增长率 irate函数 只针对counter指标类型

计算Counter指标增长率 我们知道Counter类型的监控指标其特点是只增不减,在没有发生重置(如服务器重启,应用重启)的情况下其样本值应该是不断增大的。为了能够更直观的表示样本数据的变化剧烈情况,需要计算样本的增长速…

普罗米修斯irate/rate算法区别(原创)

文章目录 irate算法流程特点代码 rate函数流程特点代码 irate算法 流程 选取时间范围内最后两个点:end1,end2 计算两个点的差值,这里分两种情况: ​ 正常情况下:end2 > end1 ,此时 value end2 - end1 ​ 异常情况…

Prometheus-rate与irate源码详解

我们先看prometheus的函数格式 一 类型 var Functions map[string]*Function{..."rate": {Name: "rate",ArgTypes: []ValueType{ValueTypeMatrix},ReturnType: ValueTypeVector,Call: funcRate,},..."irate": {Name: &qu…

Prometheus监控:rate与irate的区别

对官网文档的解读 irate和rate都会用于计算某个指标在一定时间间隔内的变化速率。但是它们的计算方法有所不同:irate取的是在指定时间范围内的最近两个数据点来算速率,而rate会取指定时间范围内所有数据点,算出一组速率,然后取平…

【博客486】prometheus-----rate,irate,increase的原理

prometheus-----rate,irate,increase的原理 三者综合比较 这三个函数接受的都是 Range Vector,返回的是 Instant Vector,比较常用。 区别: rate计算指定时间范围内:增量/时间范围; irate计算指…

【博客650】irate适用于绘制细粒度灵敏图,但警惕用于告警

irate适用于绘制细粒度灵敏图,但警惕用于告警 1、irate解析 作用: irate(v range-vector) 函数用于计算区间向量的增长率,但是其反应出的是瞬时增长率。 原理: irate 函数是通过区间向量中最后两个两本数据来计算区间向量的增长…

git查看用户名和密码

一、查看 查看用户名 :git config user.name 查看密码: git config user.password 查看邮箱:git config user.email 查看配置信息: $ git config --list 二、修改 修改用户名 git config --global user.name “xxxx(新的用户名)”…

Linux中git保存用户名密码

Linux下命令行使用git,每次操作都要输入用户名和密码很麻烦,可以通过配置保存用户名和密码。 进入到git项目的根目录下,打开.git目录下的config文件 cd .git vim config添加如下内容 [credential]helper store:wq保存退出 执行上述操作之…

git设置单个仓库用户名以及密码

有些时候我们的服务器可能要部署多个git仓库,不同git仓库的用户名以及密码都是不一样的,此时需要我们设置单个仓库的用户名以及密码。 1.git设置用户名以及邮箱 命令如下: git config user.name "userName" //你的用户名 …

git 修改用户名和密码

windows 在控制面板修改凭证就可以进行修改用户名密码。 Linux 执行vim ~/.git-credentials,可以看到被保存的账号密码,删掉、修改或新增都可以! eg:http://账号:密码git仓库http地址或用https://账号:密码git仓库http地址 h…

mac下git设置用户名密码

设置用户名和邮箱 git config --global user.name [username] git config --global user.email [email] 查看用户名和邮箱 git config --global user.name git config --global user.email 查看配置文件 git config --list 编辑配置文件 vi .gitconfig sourcetree中的…

linux 分配git用户名和密码,配置Git记住用户名密码的俩种方法

前言 相信大家在使用github过程中,也有这情况,总是让大家输入烦人的用户名,密码,浪费时间。下面这俩种办法也是网上找来的,我做了些整合,避免大家走入当时跟我一样的坑中。 方法一 1.1创建文件储存git用户名…

git重新设置用户名密码

设置密码 我们输入git config --global user.name "youname"设置密码,在输入git config --global user.email "aaqq.com"设置邮箱

git设置用户名、密码和邮箱(全局设置)

(1)git设置用户名(如下图一): git config --global user.name Urasaki (2)git设置密码(如下图一): git config --global user.password Am100100 &#xff…

设置git账户名和密码

git config --global user.email [email] //邮箱 git config --global user.name [username] //密码查看是否配置成功 git config --list出现user.email和user.name表示配置成功