如何将 histogram_quantile 与仪表进行布尔比较?

How to boolean compare histogram_quantile against gauge?

我想将 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。请注意,我用非常小的数字乘以仪表。这只是为了明确表示它将始终 <= 比分位数。如果我将它们分别输入到 Prometheus Web UI.

,那么这两个“子查询”都可以工作

为什么这不起作用?

当我用一个比率切换分位数时,它突然起作用了:

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

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

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

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

的示例中有效
histogram_quantile(1.0, sum by (le) (rate(discoverer__round_duration_seconds_bucket[1m]))) > bool avg(discoverer__info_interval_seconds) * 0.1