多client向同一个pushgateway推送指标被覆盖问题

问题:

多个client向同一个pushgateway推送指标,每个client推送的指标名称相同但是lable不同。如下:

bash 复制代码
# TYPE ObjectCount gauge
ObjectCount{server_id="server1"} 4
ObjectCount{server_id="server2"} 4
ObjectCount{server_id="server3"} 0

推送地址如下:

bash 复制代码
http://192.168.0.1/metrics/job/test

结果从pushgateway处只能查询其中一个client推送的指标,推测时发生了覆盖。

原因:

根据官方文档描述

Pushed metrics are managed in groups, identified by a grouping key of any number of labels, of which the first must be the job label.

grouping key是这些metrics的唯一标识,grouping key实际上就是若干个label的组合。

也就是说上述指标都推送到http://192.168.0.1/metrics/job/test,会被pushgateway认为是同一组指标的多次推送,所以发生了覆盖。

解决:

每个client需要推送到独立的url上,即每个client的grouping key需要不一样。例如三个client的推送URL改为:

bash 复制代码
http://192.168.0.1/metrics/job/test/server_id/server1

http://192.168.0.1/metrics/job/test/server_id/server2

http://192.168.0.1/metrics/job/test/server_id/server3

问题便可迎刃而解

参考:

解决pushgateway数据多次推送会覆盖的问题_pushgateway 数据覆盖-CSDN博客

the same metric with different labels override each other · Issue #65 · prometheus/pushgateway · GitHub

GitHub - prometheus/pushgateway: Push acceptor for ephemeral and batch jobs.

相关推荐
Clown954 小时前
go-zero(十九)使用Prometheus监控ES指标
elasticsearch·golang·prometheus
奔跑中的小象5 小时前
基于 nvitop+Prometheus+Grafana 的物理资源与 VLLM 引擎服务监控方案
grafana·prometheus·vllm·nvitop
小黑_深呼吸8 小时前
Prometheus实战教程:k8s平台-Mysql监控案例
运维·学习·kubernetes·prometheus
艾文伯特1 天前
Prometheus+Grafana+AlertManager完整安装过程
grafana·prometheus
一个向上的运维者7 天前
Prometheus生产实战全流程详解(存储/负载/调度篇)
云原生·prometheus
hwj运维之路7 天前
k8s监控方案实践(一):部署Prometheus与Node Exporter
容器·kubernetes·prometheus
Mr.小怪7 天前
自定义prometheus exporter实现监控阿里云RDS
阿里云·adb·prometheus
阿里云云原生7 天前
剑指大规模 AI 可观测,阿里云 Prometheus 2.0 应运而生
人工智能·阿里云·prometheus
小黑_深呼吸9 天前
Prometheus实战教程:k8s平台-Redis监控案例
运维·kubernetes·prometheus·监控
码上淘金9 天前
【Prometheus】业务指标与基础指标的标签来源差异及设计解析(扩展版)
prometheus