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

相关推荐
DaxiaLeeSuper7 小时前
Prometheus+Grafana+node_exporter监控linux服务器资源的方案
linux·grafana·prometheus
core5121 天前
Grafana接入Prometheus实战
grafana·prometheus
奈斯ing2 天前
【prometheus+Grafana篇】PromQL核心函数解析:rate()与irate()函数详解
运维·grafana·prometheus
lingRJ7773 天前
从混沌到掌控:基于OpenTelemetry与Prometheus构建分布式调用链监控告警体系
java·springboot·prometheus·backend·opentelemetry·jaeger·microservices
码上淘金5 天前
【Prometheus 】通过 Pushgateway 上报指标数据
prometheus
JAVA拾贝7 天前
Prometheus+Grafana运维监控并实现钉钉告警
运维·钉钉·grafana·prometheus·运维监控
TDengine (老段)20 天前
使用 Prometheus 访问 TDengine ---
大数据·数据库·prometheus·时序数据库·iot·tdengine·涛思数据
枫桥听月20 天前
16.大数据监控
大数据·prometheus
广目软件20 天前
GM DC Monitor v2.0 卸载教程
服务器·网络·zabbix·prometheus
不太聪明的样子22 天前
c++ 项目使用 prometheus + grafana 进行实时监控
c++·grafana·prometheus