神坑!为什么prometheus的pushgateway不能对上报的counter进行累加?

部署了一个prometheus的pushgateway,然后两次对其发送counter类型的数据:

#第一次发送
curl -X POST -d '# TYPE my_first_metric_ahfu counter
my_first_metric_ahfu{container="xx1",IP="192.168.31.2"} 1904
'  "http://pushgateway-test.ahfuzhang.com/metrics/job/test_job/instance/test_inst" -v

在pushgateway中查到,值为1904,符合预期。

#第二次发送
curl -X POST -d '# TYPE my_first_metric_ahfu counter
my_first_metric_ahfu{container="xx1",IP="192.168.31.2"} 2
'  "http://pushgateway-test.ahfuzhang.com/metrics/job/test_job/instance/test_inst" -v

预期值为 1904 + 2 = 1906,但查看值为2.

坑死了!看来没法用pushgateway来上报counter类型的数据了。

posted on 2021-08-10 18:55  ahfuzhang  阅读(304)  评论(0编辑  收藏  举报