3

我正在尝试使用 Prometheus 和 VictoriaMetrics 来收集数据,并且在配置我的服务器 prometheus.yml 时有一行:

scrape_interval: 15s  # How frequently to scrape targets by default.

这是否意味着我的搜索结果可能会延迟 15 秒?

4

1 回答 1

3

是的,这意味着在最坏的情况下,您的指标将在 15 秒后到达。您可以将其配置为更快。

<duration>: a duration matching the regular expression [0-9]+(ms|[smhdwy])

以上来自 Prometheus 文档:https ://prometheus.io/docs/prometheus/latest/configuration/configuration/#duration

通常,将其视为 Prometheus 对您的(连续)指标(使用的 CPU、运行的线程数等)进行快照,而不是将 Prometheus 视为收集离散事件的地方。

当您考虑触发警报需要多长时间或数据可见时,抓取间隔是需要牢记的一个因素。

在警报的上下文中,一个很好的资源是这篇文章:https ://pracucci.com/prometheus-understanding-the-delays-on-alerting.html

它基本上说,如果您的抓取间隔是x时间单位,并且您仅在时间单位的表达式为真时触发警报y,那么延迟最坏的情况可能是 (x + y) 时间单位。

于 2020-04-10T17:04:22.840 回答