haskell-github-trust / ekg-core

Library for tracking system metrics
BSD 3-Clause "New" or "Revised" License
40 stars 39 forks source link

Raise an exception on negative arguments passed to Counter.add #3

Open tibbe opened 10 years ago

tibbe commented 10 years ago

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

seanparsons commented 9 years ago

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.

tibbe commented 9 years ago

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.