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

4/26/2020

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.

-- Gill Varghese Sajan
c#
grafana
kubernetes
metrics
prometheus

1 Answer

4/26/2020

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.

-- Yaron Idan
Source: StackOverflow