statsd: fixed timed logic

This commit is contained in:
RhodeCode Admin 2023-01-05 09:46:49 +01:00
parent 2672be414c
commit 2fb5b22ffd

View file

@ -44,9 +44,9 @@ class StatsClientBase(object):
def pipeline(self):
raise NotImplementedError()
def timer(self, stat, rate=1, tags=None):
def timer(self, stat, rate=1, tags=None, auto_send=True):
"""
statsd = StatsdClient()
statsd = StatsdClient.statsd
with statsd.timer('bucket_name', auto_send=True) as tmr:
# This block will be timed.
for i in xrange(0, 100000):
@ -54,7 +54,7 @@ class StatsClientBase(object):
# you can access time here...
elapsed_ms = tmr.ms
"""
return Timer(self, stat, rate, tags)
return Timer(self, stat, rate, tags, auto_send=auto_send)
def timing(self, stat, delta, rate=1, tags=None, use_decimals=True):
"""