当前位置:网站首页>解决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})
边栏推荐
- 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
- C language to implement a password manager (under update)
- Zzuli:1058 solving inequalities
- Yolov5进阶之七目标追踪最新环境搭建(二)
- Explanation of time complexity and space complexity
- Qt—绘制其他东西
- Zzuli:1056 lucky numbers
- [engine development] in depth GPU and rendering optimization (basic)
- Zero copy underlying analysis
- 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
猜你喜欢
[graphics] hair simulation in tressfx
ASTC texture compression (adaptive scalable texture compression)
Open under vs2019 UI file QT designer flash back problem
PS tips - draw green earth with a brush
4-24--4-28
【微信小程序】WXSS 模板样式
链表有环,快慢指针走3步可以吗
Byte practice plane longitude 2
To improve efficiency or increase costs, how should developers understand pair programming?
C string format (decimal point retention / decimal conversion, etc.)
随机推荐
Remote server background hangs nohup
TPS61170QDRVRQ1
C string format (decimal point retention / decimal conversion, etc.)
什么是one-hot encoding?Pytorch中,将label变成one hot编码的两种方式
556. The next larger element III: simple construction simulation questions
Yolov5 advanced 8 format conversion between high and low versions
Explanation of time complexity and space complexity
My QT learning path -- how qdatetimeedit is empty
QT - draw something else
C language STR function
[graphics] real shading in Unreal Engine 4
Neon global and Chinese markets 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market of optical fiber connectors 2022-2028: Research Report on technology, participants, trends, market size and share
4-20-4-23 concurrent server, TCP state transition;
Several sentences extracted from the book "leather bag"
Vs+qt multithreading implementation -- run and movetothread
Use of form text box (I) select text
Zzuli:1055 rabbit reproduction
Introduction to opengl4.0 tutorial computing shaders
How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03