From 5a44b92c3c1740823b7080932b7cad9597c2bdee Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Tue, 30 Jun 2015 18:18:42 -0400 Subject: [PATCH] Simplify some code. --- datadog/dogstatsd/base.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/datadog/dogstatsd/base.py b/datadog/dogstatsd/base.py index 029dd590e..f48e50e11 100644 --- a/datadog/dogstatsd/base.py +++ b/datadog/dogstatsd/base.py @@ -143,12 +143,8 @@ def __call__(self, func): """Decorator which returns the elapsed time of the function call.""" @wraps(func) def wrapped(*args, **kwargs): - start = time() - result = func(*args, **kwargs) - self.statsd.timing( - self.metric, time() - start, tags=self.tags, - sample_rate=self.sample_rate) - return result + with self: + return func(*args, **kwargs) return wrapped def __enter__(self):