Merge pull request #3144 from edx/diana/monitor-xqueue-graders
Add in metric tracking to xqueue.
This commit is contained in:
@@ -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.')
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ from certificates.models import CertificateStatuses as status
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.http import HttpResponse
|
||||
import json
|
||||
from dogapi import dog_stats_api
|
||||
from capa.xqueue_interface import XQUEUE_METRIC_NAME
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -72,6 +74,12 @@ def update_certificate(request):
|
||||
'return_code': 1,
|
||||
'content': 'invalid cert status'}),
|
||||
mimetype='application/json')
|
||||
|
||||
dog_stats_api.increment(XQUEUE_METRIC_NAME, tags=[
|
||||
u'action:update_certificate',
|
||||
u'course_id:{}'.format(cert.course_id)
|
||||
])
|
||||
|
||||
cert.save()
|
||||
return HttpResponse(json.dumps({'return_code': 0}),
|
||||
mimetype='application/json')
|
||||
mimetype='application/json')
|
||||
|
||||
Reference in New Issue
Block a user