I can increment the micrometer counter by doing like this:
meterRegistry.counter("SOME_COUNTER").increment();
But, when I do the below:
meterRegistry.counter("SOME_COUNTER").increment(-1);
It is not decrementing the value. How can I decrement the counter value by 1?
A micrometer counter can only ever go up. From the Javadoc (emphasis mine):
Counters monitor monotonically increasing values. Counters may never be reset to a lesser value.
You might have to switch to a Gauge if your value can go down as well as up.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With