Show More
@@ -221,7 +221,7 b' class Lock(object):' | |||||
221 | """ |
|
221 | """ | |
222 | logger = loggers["acquire"] |
|
222 | logger = loggers["acquire"] | |
223 |
|
223 | |||
224 | logger.debug("Getting acquire on %r ...", self._name) |
|
224 | logger.debug("Getting blocking: %s acquire on %r ...", blocking, self._name) | |
225 |
|
225 | |||
226 | if self._held: |
|
226 | if self._held: | |
227 | owner_id = self.get_owner_id() |
|
227 | owner_id = self.get_owner_id() | |
@@ -252,7 +252,7 b' class Lock(object):' | |||||
252 | logger.warning("Failed to get %r.", self._name) |
|
252 | logger.warning("Failed to get %r.", self._name) | |
253 | return False |
|
253 | return False | |
254 |
|
254 | |||
255 |
logger. |
|
255 | logger.debug("Got lock for %r.", self._name) | |
256 | if self._lock_renewal_interval is not None: |
|
256 | if self._lock_renewal_interval is not None: | |
257 | self._start_lock_renewer() |
|
257 | self._start_lock_renewer() | |
258 | return True |
|
258 | return True |
@@ -45,6 +45,15 b' class StatsClientBase(object):' | |||||
45 | raise NotImplementedError() |
|
45 | raise NotImplementedError() | |
46 |
|
46 | |||
47 | def timer(self, stat, rate=1, tags=None): |
|
47 | def timer(self, stat, rate=1, tags=None): | |
|
48 | """ | |||
|
49 | statsd = StatsdClient() | |||
|
50 | with statsd.timer('bucket_name', auto_send=True) as tmr: | |||
|
51 | # This block will be timed. | |||
|
52 | for i in xrange(0, 100000): | |||
|
53 | i ** 2 | |||
|
54 | # you can access time here... | |||
|
55 | elapsed_ms = tmr.ms | |||
|
56 | """ | |||
48 | return Timer(self, stat, rate, tags) |
|
57 | return Timer(self, stat, rate, tags) | |
49 |
|
58 | |||
50 | def timing(self, stat, delta, rate=1, tags=None, use_decimals=True): |
|
59 | def timing(self, stat, delta, rate=1, tags=None, use_decimals=True): |
General Comments 0
You need to be logged in to leave comments.
Login now