statsd/audit-logs: cleanup push/pull user agent code.

- add normalization
- add user-agent tag into statsd call so we can track protocol/vcs type usage
- internal merge also sends in repo type
This commit is contained in:
RhodeCode Admin 2023-01-21 14:38:37 +01:00
parent 59792e6457
commit c691bf8c9a
8 changed files with 32 additions and 7 deletions

View file

@ -939,8 +939,9 @@ class PullRequestModel(BaseModel):
return commit_ids
def merge_repo(self, pull_request, user, extras):
repo_type = pull_request.source_repo.repo_type
log.debug("Merging pull request %s", pull_request.pull_request_id)
extras['user_agent'] = 'internal-merge'
extras['user_agent'] = '{}/internal-merge'.format(repo_type)
merge_state = self._merge_pull_request(pull_request, user, extras)
if merge_state.executed:
log.debug("Merge was successful, updating the pull request comments.")