'Measure request duration
request_time is a datetime.timedelta'

def access(self, resp, req, environ, request_time):

    Logger.access(self, resp, req, environ, request_time)
    duration_in_ms = ((request_time.seconds * 1000) + (float(request_time.microseconds) / (10 ** 3)))
    status = resp.status
    if isinstance(status, str):
        status = int(status.split(None, 1)[0])
    self.histogram('gunicorn.request.duration', duration_in_ms)
    self.increment('gunicorn.requests', 1)
    self.increment(('gunicorn.request.status.%d' % status), 1)
