##// END OF EJS Templates
metrics: add response code, and fix user problem on metrics
super-admin -
r4794:f0b7e732 default
parent child Browse files
Show More
@@ -63,18 +63,22 b' class RequestWrapperTween(object):'
63
63
64 statsd = request.registry.statsd
64 statsd = request.registry.statsd
65 if statsd:
65 if statsd:
66 resp_code = response.status_code
67 user_id = getattr(_auth_user, 'user_id', _auth_user)
66 elapsed_time_ms = 1000.0 * total
68 elapsed_time_ms = 1000.0 * total
67 statsd.timing(
69 statsd.timing(
68 'rhodecode_req_timing', elapsed_time_ms,
70 'rhodecode_req_timing', elapsed_time_ms,
69 tags=[
71 tags=[
70 "path:{}".format(_path),
72 "path:{}".format(_path),
71 "user:{}".format(_auth_user.user_id)
73 "user:{}".format(user_id),
74 "code:{}".format(resp_code)
72 ]
75 ]
73 )
76 )
74 statsd.incr(
77 statsd.incr(
75 'rhodecode_req_count', tags=[
78 'rhodecode_req_count', tags=[
76 "path:{}".format(_path),
79 "path:{}".format(_path),
77 "user:{}".format(_auth_user.user_id)
80 "user:{}".format(user_id),
81 "code:{}".format(resp_code)
78 ])
82 ])
79
83
80 return response
84 return response
General Comments 0
You need to be logged in to leave comments. Login now