dbnd.log_duration
- dbnd.log_duration(metric_key, source='user')
Measure time of function or code block, and log to Databand as a metric.
Can be used as a decorator and in “with” statement as a context manager.
Example 1:
@log_duration("f_time_duration") def f(): sleep(1)
Example 2:
with log_duration("my_code_duration"): sleep(1)