Commit d76241e6 by Vik Paruchuri

prefix metrics with lms, use tags for enrollment

parent e02d8403
......@@ -206,7 +206,7 @@ def change_enrollment(request):
return {'success': False,
'error': 'enrollment in {} not allowed at this time'
.format(course.display_name)}
statsd.increment("user.enrollment_in_" + str(course_id))
statsd.increment("lms.user.enrollment",tags=["course:" + str(course_id)])
enrollment, created = CourseEnrollment.objects.get_or_create(user=user, course_id=course.id)
return {'success': True}
......@@ -214,7 +214,7 @@ def change_enrollment(request):
try:
enrollment = CourseEnrollment.objects.get(user=user, course_id=course_id)
enrollment.delete()
statsd.increment("user.unenrollment_in_" + str(course_id))
statsd.increment("lms.user.unenrollment", tags=["course:"+ str(course_id)])
return {'success': True}
except CourseEnrollment.DoesNotExist:
return {'success': False, 'error': 'You are not enrolled for this course.'}
......@@ -263,7 +263,7 @@ def login_user(request, error=""):
log.info("Login success - {0} ({1})".format(username, email))
try_change_enrollment(request)
statsd.increment("user.successful_login")
statsd.increment("lms.user.successful_login")
return HttpResponse(json.dumps({'success': True}))
log.warning("Login failed - Account not active for user {0}, resending activation".format(username))
......@@ -469,7 +469,7 @@ def create_account(request, post_override=None):
log.debug('bypassing activation email')
login_user.is_active = True
login_user.save()
statsd.increment("user.account_created")
statsd.increment("lms.user.account_created")
js = {'success': True}
return HttpResponse(json.dumps(js), mimetype="application/json")
......
......@@ -55,9 +55,9 @@ class CorrectMap(object):
}
if correctness=="correct":
statsd.increment("user.correct_answer")
statsd.increment("lms.user.correct_answer")
else:
statsd.increment("user.incorrect_answer")
statsd.increment("lms.user.incorrect_answer")
def __repr__(self):
return repr(self.cmap)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment