# HG changeset patch # User RhodeCode Admin # Date 2022-10-14 20:05:39 # Node ID 317404db32fe6a206c5d7750030fa267bd974a80 # Parent 1a40cc02c814f4d688a52ccd85e00d73bc938cf3 metrics: further adjustments. - reduce cardinality - added push/pull 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,7 @@ def error_handler(exception, request): statsd = request.registry.statsd if statsd and base_response.status_code > 499: - statsd.incr('rhodecode_exception') + statsd.incr('rhodecode_exception', tags=["code:{}".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/hooks_base.py b/rhodecode/lib/hooks_base.py --- a/rhodecode/lib/hooks_base.py +++ b/rhodecode/lib/hooks_base.py @@ -34,6 +34,7 @@ from rhodecode.lib.utils2 import safe_st from rhodecode.lib.exceptions import ( HTTPLockedRC, HTTPBranchProtected, UserCreationError) from rhodecode.model.db import Repository, User +from rhodecode.lib.statsd_client import StatsdClient log = logging.getLogger(__name__) @@ -219,6 +220,10 @@ def post_pull(extras): 'user.pull', action_data={'user_agent': extras.user_agent}, user=audit_user, repo=repo, commit=True) + statsd = StatsdClient.statsd + if statsd: + statsd.incr('rhodecode_pull') + output = '' # make lock is a tri state False, True, None. We only make lock on True if extras.make_lock is True and not is_shadow_repo(extras): @@ -264,6 +269,10 @@ def post_push(extras): 'commit_ids': commit_ids[:400]}, user=audit_user, repo=repo, commit=True) + statsd = StatsdClient.statsd + if statsd: + statsd.incr('rhodecode_push') + # Propagate to external components. output = '' # make lock is a tri state False, True, None. We only release lock on False 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 @@ -69,15 +69,15 @@ class RequestWrapperTween(object): statsd.timing( 'rhodecode_req_timing', elapsed_time_ms, tags=[ - "path:{}".format(_path), - "user:{}".format(user_id), + #"path:{}".format(_path), + #"user:{}".format(user_id), "code:{}".format(resp_code) ] ) statsd.incr( 'rhodecode_req_count', tags=[ - "path:{}".format(_path), - "user:{}".format(user_id), + #"path:{}".format(_path), + #"user:{}".format(user_id), "code:{}".format(resp_code) ])