statsdmetrics/client/timing.py
def time_callable(self, name, target, rate=None, args=(), kwargs={}):
        # type: (str, Callable, float, Tuple, Dict) -> Chronometer
        """Send a Timer metric calculating duration of execution of the provided callable"""
        assert callable(target)
        if rate is None:
            rate = self._rate
        else:
            assert_sample_rate(rate)
        start_time = time()  # type: float
        result = target(*args, **kwargs)
        self.since(name, start_time, rate)
        return result
def time_callable(self, name, target, rate=None, args=(), kwargs={}):
        # type: (str, Callable, float, Tuple, Dict) -> Chronometer
        """Send a Timer metric calculating duration of execution of the provided callable"""
        assert callable(target)
        if rate is None:
            rate = self._rate
        else:
            assert_sample_rate(rate)
        start_time = time()  # type: float
        result = target(*args, **kwargs)
        self.since(name, start_time, rate)
        return result
Send a Timer metric calculating duration of execution of the provided callable