【问题标题】:How to boolean compare histogram_quantile against gauge?如何将 histogram_quantile 与仪表进行布尔比较?
【发布时间】:2020-08-17 15:45:03
【问题描述】:

我想将返回的 histogram_quantile 的即时向量与量规进行比较。

(
  histogram_quantile(1.0,
    sum by (le) (
      rate(discoverer__round_duration_seconds_bucket[1m])
    )
  )
)
>= bool
(
  discoverer__info_interval_seconds * 0.0001
)

但我得到的是no datapoints found。请注意,我将仪表与一个非常小的数字相乘。这只是为了明确它总是

为什么这不起作用?

当我以某个速率切换分位数时,它突然起作用了:

(
  rate(discoverer__round_duration_seconds_sum[1m])
  /
  rate(discoverer__round_duration_seconds_count[1m])
)
> bool
(
  discoverer__info_interval_seconds * 0.02
)

我确保所有查询都能自行运行。

我希望看到类似于第二个屏幕截图的内容。 只用百分位数,因为我更喜欢它为我的警报计算。

【问题讨论】:

    标签: prometheus promql


    【解决方案1】:

    我通过将仪表包裹在 avg() 中使其工作。不过,我真的很想知道为什么它在一个没有avg() 的例子中有效。

    histogram_quantile(1.0, sum by (le) (rate(discoverer__round_duration_seconds_bucket[1m]))) > bool avg(discoverer__info_interval_seconds) * 0.1
    

    【讨论】:

      猜你喜欢
      • 2020-06-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多