ekg-core icon indicating copy to clipboard operation
ekg-core copied to clipboard

Raise an exception on negative arguments passed to Counter.add

Open tibbe opened this issue 10 years ago • 2 comments

To partly address #2 we should raise an exception if someone passes a negative argument to Counter.add.

tibbe avatar Oct 20 '14 08:10 tibbe

Somewhat playing devils advocate should counters always be increasing or is that just for RRD support? I'm using something similar for an inflight request count, incrementing at the start and decrementing on completion, otherwise something like that would have to be a gauge and somewhat manual.

seanparsons avatar Apr 02 '15 07:04 seanparsons

The main reason is that if you're guaranteed that a counter is non-decreasing, you can detect when a process you're monitoring crashes (because the counter would go backwards) and correct for it.

tibbe avatar Apr 07 '15 21:04 tibbe