当前位置:网站首页>解决pushgateway数据多次推送会覆盖的问题
解决pushgateway数据多次推送会覆盖的问题
2022-07-03 15:02:00 【Initial-T】
问题
多个client,往同一台pushgateway推送数据时,采用同一个job名称,会发现始终只能留下一个client的数据,其他的会被覆盖
使用语言 python
分析
通过抓包发现,所有数据均已推送到9091端口,所以排除是某个client推送的问题
代码
push_to_gateway(pushgateway_url, job=job_name, registry=registry)相当于推送到了 metrics/job/job_name
问题原因
推送的指标按组进行管理,由任意数量标签的分组键标识,一般有Job跟instance,推送时候只指定Job的话,会误将几个server推送的数据当成同一组数据,出现覆盖的情况
所以应该在分组标识中加入该批数据的唯一标识,即推送的链接应该为该批数据的唯一指定存放位置,类似门牌号的概念。只用job的话相当于都推到同一个位置了。
解决
推送到 metrics/job/job_name/instance/id即可
在这里可以推到 metrics/job/job_name/client/client_name
参照python库的用法
https://github.com/prometheus/client_python

改为下述代码即可成功推送
push_to_gateway(pushgateway_url, job=job_name, registry=registry,grouping_key={"client":client_name})边栏推荐
- C language fcntl function
- Zzuli: sum of 1051 square roots
- Global and Chinese markets for indoor HDTV antennas 2022-2028: Research Report on technology, participants, trends, market size and share
- Mmdetection learning rate and batch_ Size relationship
- Explanation of time complexity and space complexity
- 零拷贝底层剖析
- Pytoch deep learning and target detection practice notes
- Global and Chinese market of transfer case 2022-2028: Research Report on technology, participants, trends, market size and share
- Use of form text box (I) select text
- Zzuli:1054 monkeys eat peaches
猜你喜欢

【Transform】【实践】使用Pytorch的torch.nn.MultiheadAttention来实现self-attention

C language DUP function

Rasterization: a practical implementation (2)

Zzuli:1053 sine function

Yolov5系列(一)——网络可视化工具netron

Série yolov5 (i) - - netron, un outil de visualisation de réseau

C string format (decimal point retention / decimal conversion, etc.)

Amazon, express, lazada, shopee, eBay, wish, Wal Mart, Alibaba international, meikeduo and other cross-border e-commerce platforms evaluate how Ziyang account can seize traffic by using products in th

How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03

Troubleshooting method of CPU surge
随机推荐
QT program font becomes larger on computers with different resolutions, overflowing controls
PS tips - draw green earth with a brush
[ue4] geometry drawing pipeline
Global and Chinese market of lighting control components 2022-2028: Research Report on technology, participants, trends, market size and share
B2020 分糖果
Déformation de la chaîne bm83 de niuke (conversion de cas, inversion de chaîne, remplacement de chaîne)
Leetcode the smallest number of the rotation array of the offer of the sword (11)
PHP GD image upload bypass
Adobe Premiere Pro 15.4 has been released. It natively supports Apple M1 and adds the function of speech to text
Composite type (custom type)
4-33--4-35
Global and Chinese markets for infrared solutions (for industrial, civil, national defense and security applications) 2022-2028: Research Report on technology, participants, trends, market size and sh
什么是Label encoding?one-hot encoding ,label encoding两种编码该如何区分和使用?
[opengl] geometry shader
Vs+qt application development, set software icon icon
C language to implement a password manager (under update)
第04章_逻辑架构
【pytorch学习笔记】Transforms
How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03
Yolov5系列(一)——網絡可視化工具netron