diff --git a/rhodecode/lib/middleware/request_wrapper.py b/rhodecode/lib/middleware/request_wrapper.py --- a/rhodecode/lib/middleware/request_wrapper.py +++ b/rhodecode/lib/middleware/request_wrapper.py @@ -63,18 +63,22 @@ class RequestWrapperTween(object): statsd = request.registry.statsd if statsd: + resp_code = response.status_code + user_id = getattr(_auth_user, 'user_id', _auth_user) elapsed_time_ms = 1000.0 * total statsd.timing( 'rhodecode_req_timing', elapsed_time_ms, tags=[ "path:{}".format(_path), - "user:{}".format(_auth_user.user_id) + "user:{}".format(user_id), + "code:{}".format(resp_code) ] ) statsd.incr( 'rhodecode_req_count', tags=[ "path:{}".format(_path), - "user:{}".format(_auth_user.user_id) + "user:{}".format(user_id), + "code:{}".format(resp_code) ]) return response