Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
9b3d68c2
Commit
9b3d68c2
authored
Mar 31, 2014
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in metric tracking to xqueue.
Covers external grading and certificates.
parent
64e28676
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletions
+30
-1
common/lib/capa/capa/responsetypes.py
+9
-0
common/lib/capa/capa/xqueue_interface.py
+12
-0
lms/djangoapps/certificates/views.py
+9
-1
No files found.
common/lib/capa/capa/responsetypes.py
View file @
9b3d68c2
...
...
@@ -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.'
)
...
...
common/lib/capa/capa/xqueue_interface.py
View file @
9b3d68c2
...
...
@@ -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
)
...
...
lms/djangoapps/certificates/views.py
View file @
9b3d68c2
...
...
@@ -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'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment