From 07801f3b9674ae23a6c3b6e061c5604499d2d36e Mon Sep 17 00:00:00 2001 From: Nimisha Asthagiri Date: Thu, 6 Oct 2016 23:38:32 -0400 Subject: [PATCH] Move performance from common to openedx/core --- lms/urls.py | 2 +- .../core}/djangoapps/performance/__init__.py | 0 .../core}/djangoapps/performance/tests/__init__.py | 0 .../core}/djangoapps/performance/tests/test_logs.py | 7 +++++-- .../core}/djangoapps/performance/views/__init__.py | 7 +++++-- 5 files changed, 11 insertions(+), 5 deletions(-) rename {common => openedx/core}/djangoapps/performance/__init__.py (100%) rename {common => openedx/core}/djangoapps/performance/tests/__init__.py (100%) rename {common => openedx/core}/djangoapps/performance/tests/test_logs.py (97%) rename {common => openedx/core}/djangoapps/performance/views/__init__.py (92%) diff --git a/lms/urls.py b/lms/urls.py index 9691bc77fc..d3de089c1d 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -33,7 +33,7 @@ urlpatterns = ( url(r'^email_confirm/(?P[^/]*)$', 'student.views.confirm_email_change'), url(r'^event$', 'track.views.user_track'), - url(r'^performance$', 'performance.views.performance_log'), + url(r'^performance$', 'openedx.core.djangoapps.performance.views.performance_log'), url(r'^segmentio/event$', 'track.views.segmentio.segmentio_event'), # TODO: Is this used anymore? What is STATIC_GRAB? diff --git a/common/djangoapps/performance/__init__.py b/openedx/core/djangoapps/performance/__init__.py similarity index 100% rename from common/djangoapps/performance/__init__.py rename to openedx/core/djangoapps/performance/__init__.py diff --git a/common/djangoapps/performance/tests/__init__.py b/openedx/core/djangoapps/performance/tests/__init__.py similarity index 100% rename from common/djangoapps/performance/tests/__init__.py rename to openedx/core/djangoapps/performance/tests/__init__.py diff --git a/common/djangoapps/performance/tests/test_logs.py b/openedx/core/djangoapps/performance/tests/test_logs.py similarity index 97% rename from common/djangoapps/performance/tests/test_logs.py rename to openedx/core/djangoapps/performance/tests/test_logs.py index 0b2b3657cc..f53938aa2c 100644 --- a/common/djangoapps/performance/tests/test_logs.py +++ b/openedx/core/djangoapps/performance/tests/test_logs.py @@ -1,4 +1,7 @@ -"""Tests that performance data is successfully logged.""" +# pylint: disable=no-member +""" +Tests that performance data is successfully logged. +""" import datetime import dateutil import json @@ -8,7 +11,7 @@ from StringIO import StringIO from django.test import TestCase from django.test.client import RequestFactory -from performance.views import performance_log +from openedx.core.djangoapps.performance.views import performance_log class PerformanceTrackingTest(TestCase): diff --git a/common/djangoapps/performance/views/__init__.py b/openedx/core/djangoapps/performance/views/__init__.py similarity index 92% rename from common/djangoapps/performance/views/__init__.py rename to openedx/core/djangoapps/performance/views/__init__.py index 78fe4e35cf..f82bd24d56 100644 --- a/common/djangoapps/performance/views/__init__.py +++ b/openedx/core/djangoapps/performance/views/__init__.py @@ -1,3 +1,6 @@ +""" +Views for logging performance data. +""" import datetime import json import logging @@ -7,7 +10,7 @@ from django.http import HttpResponse from track.utils import DateTimeJSONEncoder -perflog = logging.getLogger("perflog") +log = logging.getLogger("perflog") def _get_request_header(request, header_name, default=''): @@ -49,6 +52,6 @@ def performance_log(request): "host": _get_request_header(request, 'SERVER_NAME'), } - perflog.info(json.dumps(event, cls=DateTimeJSONEncoder)) + log.info(json.dumps(event, cls=DateTimeJSONEncoder)) return HttpResponse(status=204)