From 67b56ae8593a22027fc1b6766f876edbcf2b333c Mon Sep 17 00:00:00 2001 From: Adam Palay Date: Wed, 3 Jun 2015 15:05:45 -0400 Subject: [PATCH] time how long imports take in datadog --- .../contentstore/views/import_export.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/cms/djangoapps/contentstore/views/import_export.py b/cms/djangoapps/contentstore/views/import_export.py index bac969bfc2..3e6768cd69 100644 --- a/cms/djangoapps/contentstore/views/import_export.py +++ b/cms/djangoapps/contentstore/views/import_export.py @@ -21,6 +21,7 @@ from django.utils.translation import ugettext as _ from django.views.decorators.http import require_http_methods, require_GET from django_future.csrf import ensure_csrf_cookie +import dogstats_wrapper as dog_stats_api from edxmako.shortcuts import render_to_response from xmodule.contentstore.django import contentstore from xmodule.exceptions import SerializationError @@ -260,13 +261,17 @@ def _import_handler(request, courselike_key, root_name, successful_url, context_ log.info("Course import %s: Extracted file verified", courselike_key) _save_request_status(request, courselike_string, 3) - courselike_items = import_func( - modulestore(), request.user.id, - settings.GITHUB_REPO_ROOT, [dirpath], - load_error_modules=False, - static_content_store=contentstore(), - target_id=courselike_key - ) + with dog_stats_api.timer( + 'courselike_import.time', + tags=[u"courselike:{}".format(courselike_key)] + ): + courselike_items = import_func( + modulestore(), request.user.id, + settings.GITHUB_REPO_ROOT, [dirpath], + load_error_modules=False, + static_content_store=contentstore(), + target_id=courselike_key + ) new_location = courselike_items[0].location logging.debug('new course at %s', new_location)