# HG changeset patch # User RhodeCode Admin # Date 2023-01-05 08:46:49 # Node ID 56c4f0445b7591826b09571784f594720bc299a6 # Parent b6a62e17a3ed79b0f7e19185251b9f192403d8b7 statsd: fixed timed logic diff --git a/rhodecode/lib/_vendor/statsd/base.py b/rhodecode/lib/_vendor/statsd/base.py --- a/rhodecode/lib/_vendor/statsd/base.py +++ b/rhodecode/lib/_vendor/statsd/base.py @@ -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): """