##// END OF EJS Templates
metrics: expose response code to logs
super-admin -
r4820:bfc036f6 default
parent child Browse files
Show More
@@ -56,6 +56,7 b' class RequestWrapperTween(object):'
56 56 _auth_user = self._get_user_info(request)
57 57 ip = get_ip_addr(request.environ)
58 58 match_route = request.matched_route.name if request.matched_route else "NOT_FOUND"
59 resp_code = getattr(response, 'status_code', 'UNDEFINED')
59 60
60 61 total = time.time() - start
61 62 log.info(
@@ -63,12 +64,11 b' class RequestWrapperTween(object):'
63 64 count, _auth_user, request.environ.get('REQUEST_METHOD'),
64 65 _path, total, get_user_agent(request. environ), _ver_,
65 66 extra={"time": total, "ver": _ver_, "ip": ip,
66 "path": _path, "view_name": match_route}
67 "path": _path, "view_name": match_route, "code": resp_code}
67 68 )
68 69
69 70 statsd = request.registry.statsd
70 71 if statsd:
71 resp_code = getattr(response, 'status_code', 'UNDEFINED')
72 72 elapsed_time_ms = round(1000.0 * total) # use ms only
73 73 statsd.timing(
74 74 "rhodecode_req_timing.histogram", elapsed_time_ms,
General Comments 0
You need to be logged in to leave comments. Login now