def _log_duration(f):
    """Record the time for a given health check to run"""

    @wraps(f)
    async def wrapped(*args, **kwargs):
        tic = time.perf_counter()
        try:
            return await f(*args, **kwargs)
        finally:
            t = time.perf_counter() - tic
            if t > 0.5:
                log = app_log.info
            else:
                log = app_log.debug
            log(f"Health check {f.__name__} took {t:.3f}s")

    return wrapped
Record the time for a given health check to run
binderhub/health.py