sivy / pystatsd

Python implementation of the Statsd client/server
http://pypi.python.org/pypi/pystatsd/
BSD 2-Clause "Simplified" License
358 stars 87 forks source link

fully clear gauges and counters after sending #71

Closed rjbs closed 11 years ago

rjbs commented 11 years ago

Without this commit, counters and gauges that have been seen before will be sent over and over, each differently.

Counters will be reset to 0 after their sending, and will send that zero over and over. Gauges will not reset at all, and will send their new value repeatedly.

To confirm that this is currently the case, I changed the debug output to include the timestamp:

print "Sending %s => count=%s @ %s" % (k, v, ts)

After sending a counter and gauge only once each:

Sending foo-counter => count=0.1 @ 1371864200
Sending foo-gauge => count=123.0 @ 1371864200

[ …10s go by… ]

Sending foo-counter => count=0.0 @ 1371864210
Sending foo-gauge => count=123.0 @ 1371864210