src/dirbs/api/__init__.py
def log_api_perf_end(response: callable) -> callable:
    """
    Logs the response time of every request to StatsD.

    Arguments:
        response: http response object
    Returns:
        response: unchanged http response object
    """
    start_time = getattr(g, 'request_start_time', None)
    if start_time is not None:
        dt = int((time.time() - start_time) * 1000)
        api_type = _metrics_type_from_req_ctxt(request)
        code = response.status_code
        statsd.timing('dirbs.api.response_time.{0}.{1}.{2}'.format(api_type, request.method, code), dt)
    else:
        logger = logging.getLogger('dirbs.flask')
        logger.warning('request_start_time not present on app context - likely an exception in a before_request '
                       'handler!')
    return response

    Logs the response time of every request to StatsD.

    Arguments:
        response: http response object
    Returns:
        response: unchanged http response object
    
Logs the response time of every request to StatsD.
Logs the response time of every request to StatsD .
def log_api_perf_end(response: callable) -> callable:
    start_time = getattr(g, 'request_start_time', None)
    if start_time is not None:
        dt = int((time.time() - start_time) * 1000)
        api_type = _metrics_type_from_req_ctxt(request)
        code = response.status_code
        statsd.timing('dirbs.api.response_time.{0}.{1}.{2}'.format(api_type, request.method, code), dt)
    else:
        logger = logging.getLogger('dirbs.flask')
        logger.warning('request_start_time not present on app context - likely an exception in a before_request '
                       'handler!')
    return response
def log_api_perf_end ( response : callable ) -> callable : start_time = getattr ( g , 'request_start_time' , None ) if start_time is not None : dt = int ( ( time . time ( ) - start_time ) * 1000 ) api_type = _metrics_type_from_req_ctxt ( request ) code = response . status_code statsd . timing ( 'dirbs.api.response_time.{0}.{1}.{2}' . format ( api_type , request . method , code ) , dt ) else : logger = logging . getLogger ( 'dirbs.flask' ) logger . warning ( 'request_start_time not present on app context - likely an exception in a before_request ' 'handler!' ) return response
Logs the response time of every request to StatsD.
Logs the response time of every request to StatsD .
"""
    Logs the response time of every request to StatsD.

    Arguments:
        response: http response object
    Returns:
        response: unchanged http response object
    """
unchanged http response object
unchanged http response object
response
response
callable
http response object
http response object