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()函數(shù)計(jì)算某個(gè)時(shí)間序列范圍內(nèi)的每秒平均增長(zhǎng)率。
?
Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for.
自適應(yīng)單調(diào)性中斷(比如target重啟導(dǎo)致的計(jì)數(shù)器重置)。
?
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.
計(jì)算結(jié)果是推算到每個(gè)時(shí)間范圍的最后而得出,允許漏抓和抓取周期與時(shí)間范圍的不完美結(jié)合。
?
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請(qǐng)求每秒增長(zhǎng)率
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應(yīng)該只和計(jì)數(shù)器一起使用。最適合告警和緩慢計(jì)數(shù)器的繪圖。
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()函數(shù)計(jì)算一段時(shí)間范圍內(nèi)某個(gè)時(shí)刻的每秒增長(zhǎng)率
?
This is based on the last two data points. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for.
基于最后兩個(gè)數(shù)據(jù)點(diǎn)進(jìn)行計(jì)算。自適應(yīng)單調(diào)性中斷(比如target重啟導(dǎo)致的計(jì)數(shù)器重置)。
?
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:
以下示例返回五分鐘內(nèi)最近兩次數(shù)據(jù)點(diǎn)的HTTP請(qǐng)求每秒增長(zhǎng)率
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應(yīng)該只和快速的、不穩(wěn)定的計(jì)數(shù)器一起使用。
?
as brief changes in the rate can reset the?FOR?clause and graphs consisting entirely of rare spikes are hard to read.
因?yàn)楸嚷识虝旱母淖兛梢猿渲礔OR語句,而且一個(gè)包含極少的峰(突然上升)的圖是很難閱讀的。
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.
轉(zhuǎn)載于:https://www.cnblogs.com/jugglee/p/8963743.html
總結(jié)
以上是生活随笔為你收集整理的Prometheus Querying Function rate() vs irate()的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《一》php多进程编程:第一次fork
- 下一篇: Airflow的SimpleHttpOp