perf: add monitoring for get_course and safe_exec (#28241)

This is to help diagnose performance issues around the SequenceMetadata
API, as part of TNL-8330.
This commit is contained in:
David Ormsbee
2021-07-21 11:19:10 -04:00
committed by GitHub
parent e191d39f59
commit 1238e5d1b4
3 changed files with 4 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
from edx_django_utils.monitoring import function_trace
import six
from six import text_type
@@ -79,6 +80,7 @@ def update_hash(hasher, obj):
hasher.update(six.b(repr(obj)))
@function_trace('safe_exec')
def safe_exec(
code,
globals_dict,

View File

@@ -4,8 +4,6 @@ MixedModuleStore allows for aggregation between multiple modulestores.
In this way, courses can be served up via either SplitMongoModuleStore or MongoModuleStore.
"""
import functools
import itertools
import logging

View File

@@ -1,8 +1,7 @@
"""
Module for the dual-branch fall-back Draft->Published Versioning ModuleStore
"""
from edx_django_utils.monitoring import function_trace
from opaque_keys.edx.locator import CourseLocator, LibraryLocator, LibraryUsageLocator
from xmodule.exceptions import InvalidVersionError
@@ -56,6 +55,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
return item
@function_trace('get_course.split_modulestore')
def get_course(self, course_id, depth=0, **kwargs):
course_id = self._map_revision_to_branch(course_id)
return super().get_course(course_id, depth=depth, **kwargs)