def get_heartbeat(request):
    """Return information about server health."""
    status = {}

    heartbeats = request.registry.heartbeats
    for name, callable in heartbeats.items():
        status[name] = callable(request)

    has_error = not all([v or v is None for v in status.values()])
    if has_error:
        request.response.status = 503

    return status