I have an application that writes to a kafka queue, and one that reads those messages from the kafka queue. I want to output an prometheus metric (a gauge) that shows a count as the value with client/event type of the message as labels. I want this count to increment and decrement based on whether the event was published from application A and decrement when it is consumed by application B.
I have a static class library common to both applications, but what I’m wondering is:
- If I defined my metric in the class library, would it not be initialised twice by the two applications?
- If a pod goes down in application A, will it re-initialise the gauge and mess with the value (which I need to keep track of messages with specific client/event types)
Any advice on this is much appreciated!