mirror of
https://github.com/ansible/awx.git
synced 2026-05-12 03:47:36 -02:30
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user