prometheus - prometheus - 总指标计数和 prometheus_tsdb_head_series 结果不同
问题描述
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
解决方案
prometheus_tsdb_head_series
涵盖过去 1-3 小时内存在的所有系列,count({__name__=~".+"})
涵盖过去 5 分钟内未过时的系列。
鉴于该配置,我猜这些其他系列来自您添加metric_relabel_configs
.
推荐阅读
- image - 是否有 Linux 工具可以从单个图像中提取多个裁剪部分?
- python - Django按最小距离排序到点列表
- node.js - 如何在快递中传递数据和重定向
- android - Android Studio 预期:Gradle 任务 assembleDebug 失败,退出代码为 1
- java - 错误属性名称是保留关键字
- splunk - 两个 Splunk 搜索结果之间的差异
- python - 如何为 Windows 10 设置 Fred 的 ImageMagick 脚本并从 python 运行这些脚本
- java - 将前导零添加到转换后的 Integer Java
- python - Tkinter 画布 (FigureCanvasTkAgg) bbox 给出 None
- visual-studio-code - 如何在 Visual Studio Code 中为 resolveCodeLens 提供参数?