多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.

相关推荐
JasonChen@6661 天前
pushgateway组件实现自定义监控数据采集(16)
grafana·prometheus·pushgateway
W_son3 天前
14.Grafana 监控看板实战:新建、调优、变量配置全流程
grafana·prometheus
真上帝的左手4 天前
2. 编程语言-Java-Spring Boot-集成SkyWalking + Prometheus 性能工程闭环实战
java·spring boot·性能优化·架构·系统架构·prometheus·skywalking
BullSmall5 天前
Prometheus监控栈安全加固全攻略
安全·grafana·prometheus
JasonChen@6667 天前
prometheus静态监控static_config案例四(10)
grafana·prometheus
JasonChen@6669 天前
prometheus静态监控static_config案例二(8)
grafana·prometheus
JasonChen@66612 天前
prometheus静态监控static_configs案例一(7)
prometheus
lisanmengmeng12 天前
prometheus的rules 配置说明
prometheus
fengkai454516 天前
Prometheus+K8s弹性伸缩综合项目
运维·kubernetes·k8s·prometheus·hpa·vpa
mengge.cloud18 天前
prometheus+k8s+弹性伸缩,综合项目
云原生·容器·kubernetes·prometheus