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
f3ff6cf3
Commit
f3ff6cf3
authored
Apr 01, 2014
by
Diana Huang
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3144 from edx/diana/monitor-xqueue-graders
Add in metric tracking to xqueue.
parents
4c23f928
9b3d68c2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
0 deletions
+29
-0
common/lib/capa/capa/responsetypes.py
+9
-0
common/lib/capa/capa/xqueue_interface.py
+12
-0
lms/djangoapps/certificates/views.py
+8
-0
No files found.
common/lib/capa/capa/responsetypes.py
View file @
f3ff6cf3
...
@@ -33,6 +33,8 @@ from sys import float_info
...
@@ -33,6 +33,8 @@ from sys import float_info
from
collections
import
namedtuple
from
collections
import
namedtuple
from
shapely.geometry
import
Point
,
MultiPoint
from
shapely.geometry
import
Point
,
MultiPoint
from
dogapi
import
dog_stats_api
# specific library imports
# specific library imports
from
calc
import
evaluator
,
UndefinedVariable
from
calc
import
evaluator
,
UndefinedVariable
from
.
import
correctmap
from
.
import
correctmap
...
@@ -1690,6 +1692,13 @@ class CodeResponse(LoncapaResponse):
...
@@ -1690,6 +1692,13 @@ class CodeResponse(LoncapaResponse):
_
=
self
.
capa_system
.
i18n
.
ugettext
_
=
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
:
if
not
valid_score_msg
:
# Translators: 'grader' refers to the edX automatic code grader.
# Translators: 'grader' refers to the edX automatic code grader.
error_msg
=
_
(
'Invalid grader reply. Please contact the course staff.'
)
error_msg
=
_
(
'Invalid grader reply. Please contact the course staff.'
)
...
...
common/lib/capa/capa/xqueue_interface.py
View file @
f3ff6cf3
...
@@ -5,11 +5,14 @@ import hashlib
...
@@ -5,11 +5,14 @@ import hashlib
import
json
import
json
import
logging
import
logging
import
requests
import
requests
from
dogapi
import
dog_stats_api
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
dateformat
=
'
%
Y
%
m
%
d
%
H
%
M
%
S'
dateformat
=
'
%
Y
%
m
%
d
%
H
%
M
%
S'
XQUEUE_METRIC_NAME
=
'edxapp.xqueue'
def
make_hashkey
(
seed
):
def
make_hashkey
(
seed
):
"""
"""
...
@@ -80,6 +83,15 @@ class XQueueInterface(object):
...
@@ -80,6 +83,15 @@ class XQueueInterface(object):
Returns (error_code, msg) where error_code != 0 indicates an error
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
# Attempt to send to queue
(
error
,
msg
)
=
self
.
_send_to_queue
(
header
,
body
,
files_to_upload
)
(
error
,
msg
)
=
self
.
_send_to_queue
(
header
,
body
,
files_to_upload
)
...
...
lms/djangoapps/certificates/views.py
View file @
f3ff6cf3
...
@@ -4,6 +4,8 @@ from certificates.models import CertificateStatuses as status
...
@@ -4,6 +4,8 @@ from certificates.models import CertificateStatuses as status
from
django.views.decorators.csrf
import
csrf_exempt
from
django.views.decorators.csrf
import
csrf_exempt
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
import
json
import
json
from
dogapi
import
dog_stats_api
from
capa.xqueue_interface
import
XQUEUE_METRIC_NAME
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -72,6 +74,12 @@ def update_certificate(request):
...
@@ -72,6 +74,12 @@ def update_certificate(request):
'return_code'
:
1
,
'return_code'
:
1
,
'content'
:
'invalid cert status'
}),
'content'
:
'invalid cert status'
}),
mimetype
=
'application/json'
)
mimetype
=
'application/json'
)
dog_stats_api
.
increment
(
XQUEUE_METRIC_NAME
,
tags
=
[
u'action:update_certificate'
,
u'course_id:{}'
.
format
(
cert
.
course_id
)
])
cert
.
save
()
cert
.
save
()
return
HttpResponse
(
json
.
dumps
({
'return_code'
:
0
}),
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