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
總結
以上是生活随笔為你收集整理的Prometheus Querying Function rate() vs irate()的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《一》php多进程编程:第一次fork
- 下一篇: Airflow的SimpleHttpOp