Add analytics on push and pull repo events in the backend.

This commit is contained in:
yackob03 2013-10-03 16:19:01 -04:00
parent e5d100842d
commit 00b8244661
5 changed files with 32 additions and 35 deletions

View file

@ -7,7 +7,7 @@ from flask import request, make_response, jsonify, abort
from functools import wraps
from data import model
from app import app
from app import app, mixpanel
from auth.auth import (process_auth, get_authenticated_user,
get_validated_token)
from util.names import parse_namespace_repository, parse_repository_name
@ -132,6 +132,9 @@ def create_repository(namespace, repository):
image = model.create_image(image_description['id'], repo)
response = make_response('Created', 201)
mixpanel.track(get_authenticated_user().username, 'push_repo')
return response
@ -177,6 +180,8 @@ def get_repository_images(namespace, repository):
resp = make_response(json.dumps(all_images), 200)
resp.mimetype = 'application/json'
mixpanel.track(get_authenticated_user().username, 'pull_repo')
return resp
abort(403)