metrics: add response code, and fix user problem on metrics
This commit is contained in:
parent
0edcacd71a
commit
bde27dcd1c
1 changed files with 6 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue