Fix up flake8 and unit test failures

* Make sure we default to localhost to not fail at the GAI check
* Cleanup some flake8 issues in the metrics module
This commit is contained in:
Matthew Jones
2016-01-29 13:59:37 -05:00
parent 16a0d8b45d
commit c7fd21ae52
3 changed files with 14 additions and 11 deletions

View File

@@ -2,28 +2,25 @@
from __future__ import absolute_import
import logging
from functools import wraps
from django_statsd.clients import statsd
logger = logging.getLogger(__name__)
from functools import wraps
from django_statsd.clients import statsd
def task_timer(fn):
@wraps(fn)
def __wrapped__(self, *args, **kwargs):
statsd.incr('tasks.{}.{}.count'.format(
self.name.rsplit('.', 1)[-1],
fn.__name__
))
self.name.rsplit('.', 1)[-1],
fn.__name__))
with statsd.timer('tasks.{}.{}.timer'.format(
self.name.rsplit('.', 1)[-1],
fn.__name__
)):
fn.__name__)):
return fn(self, *args, **kwargs)
return __wrapped__
class BaseTimer(object):
def __init__(self, name, prefix=None):
self.name = name.rsplit('.', 1)[-1]
@@ -34,8 +31,8 @@ class BaseTimer(object):
@wraps(fn)
def __wrapped__(obj, *args, **kwargs):
statsd.incr('{}.{}.count'.format(
self.name,
fn.__name__
self.name,
fn.__name__
))
with statsd.timer('{}.{}.timer'.format(
self.name,