Prometheus Querying Function rate() vs irate()

rate()

rate(v range-vector) calculates the per-second average rate of increase of the time series in the range vector.

rate()函数计算某个时间序列范围内的每秒平均增长率

Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for.

自适应单调性中断(比如target重启导致的计数器重置)。

Also, the calculation extrapolates to the ends of the time range, allowing for missed scrapes or imperfect alignment of scrape cycles with the range‘s time period.

计算结果是推算到每个时间范围的最后而得出,允许漏抓和抓取周期与时间范围的不完美结合。

The following example expression returns the per-second rate of HTTP requests as measured over the last 5 minutes, per time series in the range vector:

以下示例返回最后五分钟HTTP请求每秒增长率

rate(http_requests_total{job="api-server"}[5m])

rate should only be used with counters. It is best suited for alerting, and for graphing of slow-moving counters.

rate应该只和计数器一起使用。最适合告警和缓慢计数器的绘图。

Note that when combining rate() with an aggregation operator (e.g. sum()) or a function aggregating over time (any function ending in _over_time), always take a rate() first, then aggregate. Otherwise rate() cannot detect counter resets when your target restarts.

irate()

irate(v range-vector) calculates the per-second instant rate of increase of the time series in the range vector.

irate()函数计算一段时间范围内某个时刻的每秒增长率

This is based on the last two data points. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for.

基于最后两个数据点进行计算。自适应单调性中断(比如target重启导致的计数器重置)。

The following example expression returns the per-second rate of HTTP requests looking up to 5 minutes back for the two most recent data points, per time series in the range vector:

以下示例返回五分钟内最近两次数据点的HTTP请求每秒增长率

irate(http_requests_total{job="api-server"}[5m])

irate should only be used when graphing volatile, fast-moving counters. Use rate for alerts and slow-moving counters,

rate应该只和快速的、不稳定的计数器一起使用。

as brief changes in the rate can reset the FOR clause and graphs consisting entirely of rare spikes are hard to read.

因为比率短暂的改变可以充值FOR语句,而且一个包含极少的峰(突然上升)的图是很难阅读的。

Note that when combining irate() with an aggregation operator (e.g. sum()) or a function aggregating over time (any function ending in _over_time), always take a irate() first, then aggregate.

Otherwise irate() cannot detect counter resets when your target restarts.

原文地址:https://www.cnblogs.com/jugglee/p/8963743.html

时间: 2024-08-04 23:14:37

Prometheus Querying Function rate() vs irate()的相关文章

prometheus杂碎

一个监控及告警的系统,内含一个TSDB(时序数据库).在我而言是一个数采程序 重要成员分三块 exploter:实际是外部接口,让各个程序实现这个接口,供普罗米修斯定时从此接口中取数 alert:告警模块 prometheus:实际上是数采模块+存储模块,但是它的存储不是持久化的 普罗米修斯的数据是一个值时间序列,例如 website_request_count{method="GET",path="/home/index",query="id=2&quo

JS中冒号的作用

转载: JS中冒号的作用1.声明对象的成员2.switch语句分支3.三元表达式 1.声明对象的成员 var Book ={    Name: '法',    Price: 100,    Discount : function(rate)   {       this.Price *= rate;    }};alert(Book.Price);Book.Discount(0.8); // 8折alert(Book.Price); 2.switch语句分支 var a = 2;switch (

requestAnimationFrame之缓动的应用

之前需要使用的定时器的时,立马想到的是setInterval(),用着用着就成为习惯,并没有遇到什么不妥之处.习惯性的操作往往容易让一个人拒绝尝试一些其他的方法.现在的方法用得好好的,没事干啥找其他法子. 摈弃习惯性操作的思想,没事还真得去尝试一些新方法,不然整天敲一样的代码不无聊么? 对于requestAnimationFrame这个东东,其实很早就知道了,但是也就只是局限于'知道'而已. 直到后面的项目中,在写一个关于榜单滚动的模块,开始当然用的还是setInterval(),榜单列表每秒向

js控制图片自动缩放,实现铺满盒子,不变形,完全局中

此js一般用于控制图片铺满盒子,但是比例不变,并且绝对局中原理:判断图片的高宽与盒子高宽的大小的关系,然后通过比例来控制图片的缩放及定位 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org

JS冒号的作用

JS中冒号的作用1.声明对象的成员2.switch语句分支3.三元表达式 1.声明对象的成员 var Book ={    Name: '法',    Price: 100,    Discount : function(rate)   {       this.Price *= rate;    }};alert(Book.Price);Book.Discount(0.8); // 8折alert(Book.Price); 2.switch语句分支 var a = 2;switch (a){ 

为百度阅读web端添加工具栏——百阅栏的诞生

在一个偶然的机会,看到了百度阅读这款产品,找了几本免费的书,打开看了看,总体还不错的样子,但是由于公司电脑的屏幕比较宽,而百度阅读设置的阅读宽度是840px的固定宽度,所以看起来就比较费劲了.宽度不提供调整也就算了,连字体.字体颜色.背景色等都没有提供调整的功能,随便打开一个小说网站基本上都会提供的吧.还有可气的是不让跨页复制,一滚动鼠标,复制的东西就取消了. 看到这么多让人无法忍受的问题后,就去官网反馈,发现官网也是垃圾的不行,反馈方式只有一种--百度阅读贴吧(你妹呀!),反馈了也没人回复,所

jQuery星级评论打分组件

<!DOCTYPE HTML><html> <head> <meta charset="utf-8"><title>jquery星级评论打分组件</title> <script src="/ajaxjs/jquery-1.6.2.min.js"></script><script> var pRate = function(box,callBack){ this

在ANGULAR的SERVICE中,哪种才是最基本的实现?(Provider)

今天刚好看到这一节. 节选一下,稍后,实操完成之后,会补上所有代码 Sometimes, it might be interesting to create configurable services. They are called providers, and despite being more complex to create, they can be configured beforebeing available to be injected inside other compon

BJDCTF 2nd Writeup

fake google 随便输点什么,url来看不是php,原样回显 那很有可能是ssti了,试试{{config}}有回显,直接打个python3的payload试试 {{().__class__.__bases__[0].__subclasses__()[177].__init__.__globals__.__builtins__['open']('/flag').read()}} 拿到flag old-hack 进去后看到是tp5,题目名字又叫old-attack,也没扫到源码,估计是现成