Skip to content

Commit

Permalink
Merge pull request #66 from DataDog/yann/timed-context-cosmetic
Browse files Browse the repository at this point in the history
Yann/timed context cosmetic
  • Loading branch information
yannmh committed Jul 1, 2015
2 parents bcfccf2 + 5a44b92 commit 16666d2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions datadog/dogstatsd/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 16666d2

Please sign in to comment.