Add prom stats for repository push, pull and verb actions
This commit is contained in:
parent
5d6876eb81
commit
c8a1b8abab
4 changed files with 18 additions and 4 deletions
|
@ -7,7 +7,7 @@ from functools import wraps
|
|||
from flask import request, make_response, jsonify, session
|
||||
|
||||
from data import model
|
||||
from app import authentication, userevents
|
||||
from app import authentication, userevents, metric_queue
|
||||
from auth.auth import process_auth, generate_signed_token
|
||||
from auth.auth_context import get_authenticated_user, get_validated_token, get_validated_oauth_token
|
||||
from auth.permissions import (ModifyRepositoryPermission, UserAdminPermission,
|
||||
|
@ -247,6 +247,7 @@ def update_images(namespace_name, repo_name):
|
|||
|
||||
track_and_log('push_repo', repo)
|
||||
spawn_notification(repo, 'repo_push', event_data)
|
||||
metric_queue.repository_push.Inc(labelvalues=[namespace_name, repo_name, 'v1'])
|
||||
return make_response('Updated', 204)
|
||||
|
||||
abort(403)
|
||||
|
@ -273,6 +274,7 @@ def get_repository_images(namespace_name, repo_name):
|
|||
resp.mimetype = 'application/json'
|
||||
|
||||
track_and_log('pull_repo', repo, analytics_name='pull_repo_100x', analytics_sample=0.01)
|
||||
metric_queue.repository_pull.Inc(labelvalues=[namespace_name, repo_name, 'v1'])
|
||||
return resp
|
||||
|
||||
abort(403)
|
||||
|
|
Reference in a new issue