count({__name__=~".+"})查询仅显示 9 但prometheus_tsdb_head_series显示 837 计数,知道为什么会有这种差异吗?两个查询不相似吗?
这是抓取配置:
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus-1'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
labels:
env: local
metric_relabel_configs:
- source_labels: [__name__]
regex: (prometheus_tsdb_head_series)
action: keep
- job_name: 'node_exporter-1'
static_configs:
- targets: ['localhost:9100']
labels:
env: local
metric_relabel_configs:
- source_labels: [__name__]
regex: (?i)(metric1|metric2|metric3)
action: keep
Run Code Online (Sandbox Code Playgroud)
prometheus_tsdb_head_series涵盖过去 1-3 小时内存在的每个系列,count({__name__=~".+"})涵盖过去 5 分钟内未过时的系列。
鉴于该配置,我猜这些其他系列是在您添加metric_relabel_configs.
我发现问题,有另一个 prometheus 进程在 localhost:9090 上运行,具有上述配置的第二个 prometheus 进程正在抓取这个不同的 prometheus 实例,这就是这两个查询之间存在差异的原因,在更正抓取配置中的端口后,我可以看到两个查询返回相同的结果。
| 归档时间: |
|
| 查看次数: |
3958 次 |
| 最近记录: |