Commit 64b117a7 by Vik Paruchuri

changed metric names, added into render page

parent 51f3b719
......@@ -206,7 +206,10 @@ def change_enrollment(request):
return {'success': False,
'error': 'enrollment in {} not allowed at this time'
.format(course.display_name)}
statsd.increment("lms.user.enrollment",tags=["course:" + str(course_id)])
split_course=course_id.split("/")
statsd.increment("lms.user.enrollment",tags=["org:" + str(split_course[0]),"course:" + str(split_course[1]),"run:" + str(split_course[2])])
enrollment, created = CourseEnrollment.objects.get_or_create(user=user, course_id=course.id)
return {'success': True}
......@@ -214,7 +217,10 @@ def change_enrollment(request):
try:
enrollment = CourseEnrollment.objects.get(user=user, course_id=course_id)
enrollment.delete()
statsd.increment("lms.user.unenrollment", tags=["course:"+ str(course_id)])
split_course=course_id.split("/")
statsd.increment("lms.user.unenrollment",tags=["org:" + str(split_course[0]),"course:" + str(split_course[1]),"run:" + str(split_course[2])])
return {'success': True}
except CourseEnrollment.DoesNotExist:
return {'success': False, 'error': 'You are not enrolled for this course.'}
......@@ -263,7 +269,9 @@ def login_user(request, error=""):
log.info("Login success - {0} ({1})".format(username, email))
try_change_enrollment(request)
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 +477,9 @@ def create_account(request, post_override=None):
log.debug('bypassing activation email')
login_user.is_active = True
login_user.save()
statsd.increment("lms.user.account_created")
js = {'success': True}
return HttpResponse(json.dumps(js), mimetype="application/json")
......
......@@ -28,6 +28,8 @@ from xmodule.x_module import ModuleSystem
from xmodule.error_module import ErrorDescriptor, NonStaffErrorDescriptor
from xmodule_modifiers import replace_course_urls, replace_static_urls, add_histogram, wrap_xmodule
from statsd import statsd
log = logging.getLogger("mitx.courseware")
......@@ -381,6 +383,10 @@ def xqueue_callback(request, course_id, userid, id, dispatch):
instance_module.grade = instance.get_score()['score']
if instance_module.grade != oldgrade or instance_module.state != old_instance_state:
instance_module.save()
course_split=course_id.split("/")
if(instance_module.state=="correct" or instance_module.state=="incorrect"):
statsd.increment("lms.user.question_answered",tags=["org:" + str(course_split[0]),"course:" + str(course_split[1]), "run:" + str(course_split[2]), "answer:" + str(instance_module.state), "score:" + str(instance_module.grade), "type:xqueue"])
return HttpResponse("")
......@@ -465,6 +471,11 @@ def modx_dispatch(request, dispatch, location, course_id):
instance_module.state != old_instance_state or
instance_module.max_grade != old_instance_max_grade):
instance_module.save()
course_split=course_id.split("/")
if(instance_module.state=="correct" or instance_module.state=="incorrect"):
statsd.increment("lms.user.question_answered",tags=["org:" + str(course_split[0]),"course:" + str(course_split[1]), "run:" + str(course_split[2]), "answer:" + str(instance_module.state), "score:" + str(instance_module.grade), "type:ajax"])
if shared_module is not None:
shared_module.state = instance.get_shared_state()
......
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