metrics: use prom metrics, and added some additional metrics
This commit is contained in:
parent
de71212b00
commit
bc8d59f1a7
8 changed files with 33 additions and 15 deletions
|
|
@ -179,7 +179,7 @@ def exception_view(exc, request):
|
|||
|
||||
statsd = request.registry.statsd
|
||||
if statsd:
|
||||
statsd.incr('rhodecode_exception', tags=["api"])
|
||||
statsd.incr('rhodecode_exception_total', tags=["exc_source:api"])
|
||||
|
||||
return jsonrpc_error(request, fault_message, rpc_id)
|
||||
|
||||
|
|
@ -296,9 +296,14 @@ def request_view(request):
|
|||
# register some common functions for usage
|
||||
attach_context_attributes(TemplateArgs(), request, request.rpc_user.user_id)
|
||||
|
||||
statsd = request.registry.statsd
|
||||
|
||||
try:
|
||||
ret_value = func(**call_params)
|
||||
return jsonrpc_response(request, ret_value)
|
||||
resp = jsonrpc_response(request, ret_value)
|
||||
if statsd:
|
||||
statsd.incr('rhodecode_api_call_success_total')
|
||||
return resp
|
||||
except JSONRPCBaseError:
|
||||
raise
|
||||
except Exception:
|
||||
|
|
@ -308,9 +313,12 @@ def request_view(request):
|
|||
id(exc_info), exc_info, prefix='rhodecode-api')
|
||||
error_headers = [('RhodeCode-Exception-Id', str(exc_id)),
|
||||
('RhodeCode-Exception-Type', str(exc_type_name))]
|
||||
return jsonrpc_error(
|
||||
err_resp = jsonrpc_error(
|
||||
request, retid=request.rpc_id, message='Internal server error',
|
||||
headers=error_headers)
|
||||
if statsd:
|
||||
statsd.incr('rhodecode_api_call_fail_total')
|
||||
return err_resp
|
||||
|
||||
|
||||
def setup_request(request):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue