简体   繁体   中英

Is there a way to increment counter in prometheus for similar metrics scraped from pushgateway

I have a running instance of pushgateway and prometheus. And prometheus is configured to scrape from pushgateway. I am able to push metrics from my .NET applications to pushgateway which are successfully scraped by my prometheus. But when a two similar metrics are pushed to pushgateway, they are considered as one by the prometheus and the count is always displayed as one. Is there a way to increment the prometheus count value when similar metrics are present in the pushgateway.

The metrics from the two apps should be separated by adding a label that will distinguish between them. This should solve your issue. Note that the pushgateway docs explicitly state that there should be no duplicate metrics.

Pushgateway is not designed to handle this situation. As the official doc said, Usually, the only valid use case for the Pushgateway is for capturing the outcome of a service-level batch job.

https://prometheus.io/docs/practices/pushing/#should-i-be-using-the-pushgateway

Or you can use this instead, which is a aggregating push gateway for Prometheus: https://github.com/weaveworks/prom-aggregation-gateway

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM