Merge "statsd: use timedelta and pipeline"

This commit is contained in:
Zuul 2021-05-04 09:23:07 +00:00 committed by Gerrit Code Review
commit 3be71c0bd4
1 changed files with 6 additions and 6 deletions

View File

@ -214,12 +214,12 @@ class Proxy(adapter.Adapter):
key = '.'.join(
[self._statsd_prefix, self.service_type, method]
+ name_parts)
if response is not None:
duration = int(response.elapsed.total_seconds() * 1000)
self._statsd_client.timing(key, duration)
self._statsd_client.incr(key)
elif exc is not None:
self._statsd_client.incr('%s.failed' % key)
with self._statsd_client.pipeline() as pipe:
if response is not None:
pipe.timing(key, response.elapsed)
pipe.incr(key)
elif exc is not None:
pipe.incr('%s.failed' % key)
def _report_stats_prometheus(self, response, url=None, method=None,
exc=None):