

def timed(self, metric=None, tags=None, sample_rate=1, use_ms=None):
    "\n        A decorator or context manager that will measure the distribution of a\n        function's/context's run time. Optionally specify a list of tags or a\n        sample rate. If the metric is not defined as a decorator, the module\n        name and function name will be used. The metric is required as a context\n        manager.\n        ::\n\n            @statsd.timed('user.query.time', sample_rate=0.5)\n            def get_user(user_id):\n                # Do what you need to ...\n                pass\n\n            # Is equivalent to ...\n            with statsd.timed('user.query.time', sample_rate=0.5):\n                # Do what you need to ...\n                pass\n\n            # Is equivalent to ...\n            start = time.time()\n            try:\n                get_user(user_id)\n            finally:\n                statsd.timing('user.query.time', time.time() - start)\n        "
    return sample_rate._TimedContextManagerDecorator(self, metric, tags, sample_rate, use_ms)

dataset/ETHPy150Open DataDog/datadogpy/datadog/dogstatsd/base.py DogStatsd.timed/VarMisuse@29/347 `self`->`sample_rate`