prometheus - 普罗米修斯中的刮擦间隔和评估间隔
问题描述
我的刮擦间隔和评估间隔彼此相差很远,如下所示(15s vs 4m)。当我向端点提供指标时,我发现规则每 4m 进行一次评估,这是预期的。但是,我不明白的是,它不会评估过去 4 分钟提供的所有指标的规则。我很难理解两个时钟(刮擦和评估)的功能。此外,这方面的文档非常稀少。任何指针都会有很大帮助。我毫不犹豫地将刮擦时间和评估时间更改为各 15 秒。但我需要了解将时钟分开的后果。
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 4m # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
- testmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
- "/etc/prometheus/xyz_rule.yml"
- "/etc/prometheus/pqr_rule.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
metrics_path: /v1/metrics/xyz
# scheme defaults to 'http'.
static_configs:
- targets: ['test:7070']
解决方案
这两个进程是独立的,PromQL 和记录规则都不知道你的抓取间隔是多少。因此,无论评估间隔是多少,在给定时间评估时,您指定的任何规则都将以相同的方式评估并获得相同的结果。
为简单起见,最好让两个间隔相同,所以我建议在这里都设置为 15s。
推荐阅读
- ajax - ajax 中的请求返回 500 内部服务器错误,但在浏览器中它在 SOAPUI 中也可以正常工作
- rust - 条件性状界限可能吗?
- delphi - 变体字节数组到十六进制字符串
- python - 当您在 pygame 中左键单击时,尝试在光标位置对图像进行 blit,但图像在不到一秒后消失
- jmeter - JMeter - 准确计算加载时间?
- angular - Angular 自定义验证器消息
- cupy - CuPy 多 GPU cuFFT 支持
- xamarin - 标签html类型在android Xamarin Forms中不呈现颜色
- python - 有没有办法在 tkinter 中正确运行程序时网格化一个额外的按钮?
- reporting-services - 报表生成器查询