Skip to content

Commit

Permalink
feat: bff function tracing (#2146)
Browse files Browse the repository at this point in the history
* feat: add function traces to BFF endpoints

* chore: bump ORA to 6.0.18
  • Loading branch information
nsprenkle authored Dec 19, 2023
1 parent de776f8 commit f4610c1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion openassessment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Initialization Information for Open Assessment Module
"""

__version__ = '6.0.17'
__version__ = '6.0.18'
11 changes: 11 additions & 0 deletions openassessment/xblock/ui_mixins/mfe/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
XBlock handlers which surface info about an ORA, instead of being tied to views.
"""
from edx_django_utils.monitoring import function_trace
from xblock.core import XBlock
from xblock.exceptions import JsonHandlerError

from openassessment.fileupload.exceptions import FileUploadError
from openassessment.assessment.errors import AssessmentError
from openassessment.workflow.errors import AssessmentWorkflowError
Expand Down Expand Up @@ -65,11 +67,14 @@ def __init__(self, status_code, error_code, error_context=''):


class MfeMixin:

@function_trace("get_block_info")
@XBlock.json_handler
def get_block_info(self, data, suffix=""): # pylint: disable=unused-argument
block_info = OraBlockInfoSerializer(self)
return block_info.data

@function_trace("get_learner_data")
@XBlock.json_handler
def get_learner_data(self, data, suffix=""): # pylint: disable=unused-argument
"""
Expand Down Expand Up @@ -104,6 +109,7 @@ def get_learner_data(self, data, suffix=""): # pylint: disable=unused-argument
serializer_context["requested_step"] = requested_step
return PageDataSerializer(self, context=serializer_context).data

@function_trace("submission_draft")
def _submission_draft_handler(self, data):
try:
student_submission_data = data['response']['textResponses']
Expand All @@ -115,6 +121,7 @@ def _submission_draft_handler(self, data):
except DraftSaveException as e:
raise OraApiException(500, error_codes.INTERNAL_EXCEPTION) from e

@function_trace("submission_create")
def _submission_create_handler(self, data):
from submissions import api as submission_api
try:
Expand Down Expand Up @@ -148,6 +155,7 @@ def submission(self, data, suffix=""):
else:
raise OraApiException(404, error_codes.UNKNOWN_SUFFIX)

@function_trace("file_delete")
def _file_delete_handler(self, data):
try:
file_index = int(data['fileIndex'])
Expand All @@ -174,6 +182,7 @@ def _get_new_file_from_list(self, file_to_add, new_list):
return file_entry
return None

@function_trace("file_add")
def _file_add_handler(self, data):
serializer = AddFileRequestSerializer(data=data)
if not serializer.is_valid():
Expand Down Expand Up @@ -219,6 +228,7 @@ def _file_add_handler(self, data):
'fileIndex': newly_added_file.index,
}

@function_trace("file_callback")
def _file_upload_callback_handler(self, data):
serializer = FileUploadCallbackRequestSerializer(data=data)
if not serializer.is_valid():
Expand Down Expand Up @@ -285,6 +295,7 @@ def get_learner_submission_data(self):
'file_data': file_data,
}

@function_trace("assessment_submit")
def _assessment_submit_handler(self, data):
serializer = AssessmentSubmitRequestSerializer(data=data)
if not serializer.is_valid():
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "edx-ora2",
"version": "6.0.17",
"version": "6.0.18",
"repository": "https://github.com/openedx/edx-ora2.git",
"dependencies": {
"@edx/frontend-build": "8.0.6",
Expand Down

0 comments on commit f4610c1

Please sign in to comment.