metrics: expose response code to logs
This commit is contained in:
parent
062734947d
commit
5d103475d6
1 changed files with 2 additions and 2 deletions
|
|
@ -56,6 +56,7 @@ class RequestWrapperTween(object):
|
|||
_auth_user = self._get_user_info(request)
|
||||
ip = get_ip_addr(request.environ)
|
||||
match_route = request.matched_route.name if request.matched_route else "NOT_FOUND"
|
||||
resp_code = getattr(response, 'status_code', 'UNDEFINED')
|
||||
|
||||
total = time.time() - start
|
||||
log.info(
|
||||
|
|
@ -63,12 +64,11 @@ class RequestWrapperTween(object):
|
|||
count, _auth_user, request.environ.get('REQUEST_METHOD'),
|
||||
_path, total, get_user_agent(request. environ), _ver_,
|
||||
extra={"time": total, "ver": _ver_, "ip": ip,
|
||||
"path": _path, "view_name": match_route}
|
||||
"path": _path, "view_name": match_route, "code": resp_code}
|
||||
)
|
||||
|
||||
statsd = request.registry.statsd
|
||||
if statsd:
|
||||
resp_code = getattr(response, 'status_code', 'UNDEFINED')
|
||||
elapsed_time_ms = round(1000.0 * total) # use ms only
|
||||
statsd.timing(
|
||||
"rhodecode_req_timing.histogram", elapsed_time_ms,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue