zoukankan      html  css  js  c++  java
  • 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
Copyright © 2011-2022 走看看