From 5d21ad5ae63addac0892242fe774250a2934fc87 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Tue, 2 Feb 2016 09:58:19 -0500 Subject: [PATCH] Fix up statsd work to support python 2.6 Format specifiers must include field specifier --- awx/lib/metrics.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/awx/lib/metrics.py b/awx/lib/metrics.py index be4bd8dedf..3cd8d3a6ce 100644 --- a/awx/lib/metrics.py +++ b/awx/lib/metrics.py @@ -11,10 +11,10 @@ logger = logging.getLogger(__name__) def task_timer(fn): @wraps(fn) def __wrapped__(self, *args, **kwargs): - statsd.incr('tasks.{}.{}.count'.format( + statsd.incr('tasks.{0}.{1}.count'.format( self.name.rsplit('.', 1)[-1], fn.__name__)) - with statsd.timer('tasks.{}.{}.timer'.format( + with statsd.timer('tasks.{0}.{1}.timer'.format( self.name.rsplit('.', 1)[-1], fn.__name__)): return fn(self, *args, **kwargs) @@ -25,16 +25,16 @@ class BaseTimer(object): def __init__(self, name, prefix=None): self.name = name.rsplit('.', 1)[-1] if prefix: - self.name = '{}.{}'.format(prefix, self.name) + self.name = '{0}.{1}'.format(prefix, self.name) def __call__(self, fn): @wraps(fn) def __wrapped__(obj, *args, **kwargs): - statsd.incr('{}.{}.count'.format( + statsd.incr('{0}.{1}.count'.format( self.name, fn.__name__ )) - with statsd.timer('{}.{}.timer'.format( + with statsd.timer('{0}.{1}.timer'.format( self.name, fn.__name__ )):