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

Timing in timing_since is being converted to microseconds then passed to timing as milliseconds #93

Closed laughingdog closed 9 years ago

laughingdog commented 9 years ago

I suspect the statsd.py code: def timing_since(self, stat, start, sample_rate=1): """ Log timing information as the number of microseconds since the provided time float

start = time.time()

do stuff

statsd_client.timing_since('some.time', start) """ self.timing(stat, int((time.time() - start) * 1000000), sample_rate)

should be converting to ms rather than usec (ie, multiply by 1000 instead of 1000000). Especially since timing pretty explicitly marks the input (ie, the value which was converted to usec) as ms: def timing(self, stat, time, sample_rate=1): """ Log timing information for a single stat

statsd_client.timing('some.time',500) """ stats = {stat: "%f|ms" % time} self.send(stats, sample_rate)

laughingdog commented 9 years ago

looks like there was a previous issue already opened for this -- I should have checked first.