From 5c8eea2728a8cb417d2cd62db8937378ef45c9ff Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 20 Nov 2015 21:29:57 -0500 Subject: [PATCH] Log when pulls occur in V2 Fixes #958 --- endpoints/v2/manifest.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/endpoints/v2/manifest.py b/endpoints/v2/manifest.py index 1ba9be99f..64affc189 100644 --- a/endpoints/v2/manifest.py +++ b/endpoints/v2/manifest.py @@ -224,6 +224,10 @@ def fetch_manifest_by_tagname(namespace, repo_name, manifest_ref): manifest_ref) raise ManifestUnknown() + repo = model.repository.get_repository(namespace, repo_name) + if repo is not None: + track_and_log('pull_repo', repo) + return make_response(manifest.json_data, 200) @@ -238,6 +242,10 @@ def fetch_manifest_by_digest(namespace, repo_name, manifest_ref): # Without a tag name to reference, we can't make an attempt to generate the manifest raise ManifestUnknown() + repo = model.repository.get_repository(namespace, repo_name) + if repo is not None: + track_and_log('pull_repo', repo) + return make_response(manifest.json_data, 200) @@ -371,6 +379,8 @@ def delete_manifest_by_digest(namespace, repo_name, manifest_ref): manifest.delete_instance() + # TODO(jschorr): Log this as a new log type. + return make_response('', 202)