Add in metric tracking to xqueue.

Covers external grading and certificates.
This commit is contained in:
Diana Huang
2014-03-31 10:50:15 -04:00
parent 64e286763d
commit 9b3d68c2b9
3 changed files with 30 additions and 1 deletions

View File

@@ -33,6 +33,8 @@ from sys import float_info
from collections import namedtuple
from shapely.geometry import Point, MultiPoint
from dogapi import dog_stats_api
# specific library imports
from calc import evaluator, UndefinedVariable
from . import correctmap
@@ -1690,6 +1692,13 @@ class CodeResponse(LoncapaResponse):
_ = self.capa_system.i18n.ugettext
dog_stats_api.increment(xqueue_interface.XQUEUE_METRIC_NAME, tags=[
'action:update_score',
'correct:{}'.format(correct)
])
dog_stats_api.histogram(xqueue_interface.XQUEUE_METRIC_NAME + '.update_score.points_earned', points)
if not valid_score_msg:
# Translators: 'grader' refers to the edX automatic code grader.
error_msg = _('Invalid grader reply. Please contact the course staff.')

View File

@@ -5,11 +5,14 @@ import hashlib
import json
import logging
import requests
from dogapi import dog_stats_api
log = logging.getLogger(__name__)
dateformat = '%Y%m%d%H%M%S'
XQUEUE_METRIC_NAME = 'edxapp.xqueue'
def make_hashkey(seed):
"""
@@ -80,6 +83,15 @@ class XQueueInterface(object):
Returns (error_code, msg) where error_code != 0 indicates an error
"""
# log the send to xqueue
header_info = json.loads(header)
queue_name = header_info.get('queue_name', u'')
dog_stats_api.increment(XQUEUE_METRIC_NAME, tags=[
u'action:send_to_queue',
u'queue:{}'.format(queue_name)
])
# Attempt to send to queue
(error, msg) = self._send_to_queue(header, body, files_to_upload)