Grafana Prometheus将$ __间隔设置为1
我现在在2s上有$ __ Interval
,因为当我尝试将其设置为1时,它将不再显示查询。为什么我能走的2秒?
iRate(rx_bytes {instance =“ localhost:2000”} [2S])
工作完美地工作
irate(rx_bytes {instance =“ localhost:localhost:2000”} [1S] [1S])
query> query> query只是消失了
I now have my $__interval
on 2s because when I try setting it to 1s it won't display the query anymore. Why is 2s the lowest I can go?
irate(rx_bytes{instance="localhost:2000"}[2s])
works perfectly fine
irate(rx_bytes{instance="localhost:2000"}[1s])
query just disappears
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Prometheus在时间戳记 以下面的方式计算
irate(m [d])
t :(td .. t] < /代码>针对名称
m
的每个系列(T2,v2)
在每个匹配系列的选定时间范围内,其中t1
和t2
是时间戳和 所选时间范围内的最后两个示例的值。V1
和V2
是 的每个匹配系列。代码>单独 在您的情况下(又称Scrape_interval)的样本更大或等于1
。继续工作)。 This is a Prometheus-like monitoring solution, which takes into account the previous raw sample just before the selected time range when calculating
irate
andrate
, so it returns the expected result for方括号中的小外观窗户。参见有关详细信息。ps建议使用
rate()
而不是irate()
在大多数情况下,因为irate()
不捕获Spikes-只需基于一组任意的原始样本执行计算即可。参见 row n nofollow noreferrer“> row noreflow noreferrer”>本文有关详细信息。Prometheus calculates
irate(m[d])
at a timestampt
in the following way:(t-d .. t]
for each series with the namem
. Note thatt-d
isn't included in the time range.(t1, v1)
and(t2, v2)
on the selected time range per each matching series, wheret1
andt2
are timestamps andv1
andv2
are values for the last two samples on the selected time range.irate=(v2-v1)/(t2-t1)
individually per each matching series.As you can see, Prometheus can calculate
irate
if the selected time range contains at least two raw samples. Otherwise it returns empty result. So, it is likely the interval between samples in your case (aka scrape_interval) is greater or equal to 1s. So any time range(t-1s .. t]
contains less than two samples.The workaround is to use VictoriaMetrics (the project I work on). This is a Prometheus-like monitoring solution, which takes into account the previous raw sample just before the selected time range when calculating
irate
andrate
, so it returns the expected result for small lookbehind windows in square brackets. See this article for details.P.S. it is recommended to use
rate()
instead ofirate()
in most cases, becauseirate()
doesn't capture spikes - it just performs calculations based on an arbitrary set of raw samples. See this article for details.