Commit f1f34b5d by David Ormsbee

Customize the transaction name sent to New Relic for XBlock handlers.

Currently, all XBlock/XModule handlers are lumped together in the
same transaction (courseware.module_render:handle_xblock_callback).
This makes it difficult to pinpoint problems with specific handlers.
With this change, the transaction name will now look like:

  OpenAssessmentBlockWithMixins.save_submission
  CapaDescriptorWithMixins.xmodule_handler/problem_show
parent bd1e7a41
......@@ -26,6 +26,8 @@ from django.http import Http404, HttpResponse
from django.test.client import RequestFactory
from django.views.decorators.csrf import csrf_exempt
import newrelic.agent
from capa.xqueue_interface import XQueueInterface
from courseware.access import has_access, get_user_role
from courseware.masquerade import setup_masquerade
......@@ -889,6 +891,13 @@ def _invoke_xblock_handler(request, course_id, usage_id, handler, suffix):
instance, tracking_context = get_module_by_usage_id(request, course_id, usage_id)
# Name the transaction so that we can view XBlock handlers separately in
# New Relic. The suffix is necessary for XModule handlers because the
# "handler" in those cases is always just "xmodule_handler".
nr_tx_name = "{}.{}".format(instance.__class__.__name__, handler)
nr_tx_name += "/{}".format(suffix) if suffix else ""
newrelic.agent.set_transaction_name(nr_tx_name, group="Python/XBlock/Handler")
tracking_context_name = 'module_callback_handler'
req = django_to_webob_request(request)
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment