# HG changeset patch # User RhodeCode Admin # Date 2022-10-25 11:59:47 # Node ID ad1f41003d932ded5555cd5603a59b6d87aa2707 # Parent b50e133bb61af2e02a1381ac45fe8ef0f7eb11d5 metrics: fixed exc type metrics diff --git a/rhodecode/api/__init__.py b/rhodecode/api/__init__.py --- a/rhodecode/api/__init__.py +++ b/rhodecode/api/__init__.py @@ -179,7 +179,7 @@ def exception_view(exc, request): statsd = request.registry.statsd if statsd: - statsd.incr('rhodecode_exception_total', tags=["exc_source:api"]) + statsd.incr('rhodecode_exception_total', tags=["exc_source:api", "type:{}".format(exc_info.type)]) return jsonrpc_error(request, fault_message, rpc_id) diff --git a/rhodecode/config/middleware.py b/rhodecode/config/middleware.py --- a/rhodecode/config/middleware.py +++ b/rhodecode/config/middleware.py @@ -182,7 +182,8 @@ def error_handler(exception, request): statsd = request.registry.statsd if statsd and base_response.status_code > 499: - statsd.incr('rhodecode_exception_total', tags=["code:{}".format(base_response.status_code)]) + statsd.incr('rhodecode_exception_total', + tags=["exc_source:web", "type:{}".format(base_response.status_code)]) error_explanation = base_response.explanation or str(base_response) if base_response.status_code == 404: diff --git a/rhodecode/lib/celerylib/loader.py b/rhodecode/lib/celerylib/loader.py --- a/rhodecode/lib/celerylib/loader.py +++ b/rhodecode/lib/celerylib/loader.py @@ -179,7 +179,7 @@ def task_failure_signal( store_exception(id(exc_info), exc_info, prefix='rhodecode-celery') statsd = StatsdClient.statsd if statsd: - statsd.incr('rhodecode_exception_total', tags=["exc_source:celery"]) + statsd.incr('rhodecode_exception_total', tags=["exc_source:celery", "type:{}".format(einfo.type)]) closer = celery_app.conf['PYRAMID_CLOSER'] if closer: diff --git a/rhodecode/lib/middleware/request_wrapper.py b/rhodecode/lib/middleware/request_wrapper.py --- a/rhodecode/lib/middleware/request_wrapper.py +++ b/rhodecode/lib/middleware/request_wrapper.py @@ -63,19 +63,20 @@ class RequestWrapperTween(object): statsd = request.registry.statsd if statsd: + match_route = request.matched_route.name if request.matched_route else _path resp_code = response.status_code elapsed_time_ms = 1000.0 * total statsd.timing( 'rhodecode_req_timing', elapsed_time_ms, tags=[ - "view_name:{}".format(request.matched_route.name), + "view_name:{}".format(match_route), #"user:{}".format(user_id), "code:{}".format(resp_code) ] ) statsd.incr( 'rhodecode_req_total', tags=[ - "view_name:{}".format(request.matched_route.name), + "view_name:{}".format(match_route), #"user:{}".format(user_id), "code:{}".format(resp_code) ])