ekg-core
ekg-core copied to clipboard
Raise an exception on negative arguments passed to Counter.add
To partly address #2 we should raise an exception if someone passes a negative argument to Counter.add
.
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.
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.