mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-17 10:42:25 -05:00
Only record the statsd timing on success.
This commit is contained in:
@@ -13,6 +13,12 @@ def statsd(namespace):
|
||||
try:
|
||||
res = func(*args, **kwargs)
|
||||
elapsed_time = monotonic() - start_time
|
||||
statsd_client.incr('{namespace}.{func}'.format(
|
||||
namespace=namespace, func=func.__name__)
|
||||
)
|
||||
statsd_client.timing('{namespace}.{func}'.format(
|
||||
namespace=namespace, func=func.__name__), elapsed_time
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
current_app.logger.error(
|
||||
@@ -27,12 +33,6 @@ def statsd(namespace):
|
||||
namespace=namespace, func=func.__name__, time="{0:.4f}".format(elapsed_time)
|
||||
)
|
||||
)
|
||||
statsd_client.incr('{namespace}.{func}'.format(
|
||||
namespace=namespace, func=func.__name__)
|
||||
)
|
||||
statsd_client.timing('{namespace}.{func}'.format(
|
||||
namespace=namespace, func=func.__name__), elapsed_time
|
||||
)
|
||||
return res
|
||||
wrapper.__wrapped__.__name__ = func.__name__
|
||||
return wrapper
|
||||
|
||||
Reference in New Issue
Block a user