I have a use case where I need to create a counter out of a combination of 2 other counters. We are using an external tool that expects a prometheus counter as input and therefore I would like to create a counter combining 2 different counters like the example below:
# Count total number of requests per service
satisfied_requests_total
# Requests per http status code
requests_per_code_total{ code="499" }
I need to have a counter that count the number_of_satisfied_requests_total
- requests_per_code_total{ code="499" }
What I want to achieve is:
- record: requests_good_example
expr: satisfied_requests_total - requests_per_code_total{ code="499" }
But of course if we have counter reset, we can end up with negative results.
Is there a way to get the expected result?
PS: Both metrics have the same labels