metrics: further adjustments.

- reduce cardinality
- added push/pull
This commit is contained in:
RhodeCode Admin 2022-10-14 22:05:39 +02:00
parent b4d077597a
commit 8e00aec5f4
3 changed files with 14 additions and 5 deletions

View file

@ -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:

View file

@ -34,6 +34,7 @@ from rhodecode.lib.utils2 import safe_str
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

View file

@ -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)
])