普罗米修斯的刮擦间隔和评估间隔

时间:2018-09-04 13:49:03

标签: prometheus prometheus-alertmanager

我的刮擦间隔和评估间隔彼此相距遥远(15s对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']

1 个答案:

答案 0 :(得分:2)

这两个过程是独立的,PromQL和记录规则都不知道您的抓取间隔是多少。因此,无论指定的评估时间间隔是多少,指定的任何规则在给定时间评估时都将以相同的方式进行评估,并且结果相同。

为简便起见,最好将两个间隔设置为相同,因此我建议在这里将两者都设置为15s。

相关问题