diff --git a/ecommerce/extensions/basket/utils.py b/ecommerce/extensions/basket/utils.py index 97c83f7e038..468a9d3f35e 100644 --- a/ecommerce/extensions/basket/utils.py +++ b/ecommerce/extensions/basket/utils.py @@ -5,7 +5,6 @@ import newrelic.agent import pytz -import waffle from django.conf import settings from django.contrib import messages from django.db import transaction @@ -32,7 +31,6 @@ logger = logging.getLogger(__name__) -@newrelic.agent.function_trace() def add_utm_params_to_url(url, params): # utm_params is [(u'utm_content', u'course-v1:IDBx IDB20.1x 1T2017'),... utm_params = [item for item in params if 'utm_' in item[0]] @@ -45,7 +43,6 @@ def add_utm_params_to_url(url, params): return url -@newrelic.agent.function_trace() def prepare_basket(request, products, voucher=None): """ Create or get the basket, add products, apply a voucher, and record referral data. @@ -117,7 +114,6 @@ def prepare_basket(request, products, voucher=None): return basket -@newrelic.agent.function_trace() def get_basket_switch_data(product): """ Given a seat or enrollment product, find the SKU of the related product of @@ -142,38 +138,6 @@ def get_basket_switch_data(product): partner_sku = _find_seat_enrollment_toggle_sku(product, 'standalone') switch_link_text = _('Click here to purchase multiple seats in this course') - if waffle.switch_is_active("debug_logging_for_get_basket_switch_data"): # pragma: no cover - msg = "get_basket_switch_data: product.course_id={}, product.get_product_class().name={}, " \ - "product.structure={}, partner_sku={}".format( - product.course_id, - product.get_product_class().name, - product.structure, - partner_sku) - logger.info(msg) - - if product.course_id is None: - if partner_sku is not None: - logger.info("get_basket_switch_data: product.course_id is None. partner_sku has been set") - - courseless_stock_records = StockRecord.objects.filter( - product__id=product.id, - ) - courseless_partner_sku = None - product_cert_type = getattr(product.attr, 'certificate_type', None) - product_seat_type = getattr(product.attr, 'seat_type', None) - for courseless_stock_record in courseless_stock_records: - stock_record_cert_type = getattr(courseless_stock_record.product.attr, 'certificate_type', None) - stock_record_seat_type = getattr(courseless_stock_record.product.attr, 'seat_type', None) - if (product_seat_type and product_seat_type == stock_record_cert_type) or \ - (product_cert_type and product_cert_type == stock_record_seat_type): - courseless_partner_sku = courseless_stock_record.partner_sku - break - if courseless_partner_sku != partner_sku: - msg = "get_basket_switch_data: courseless_partner_sku {} != original_partner_sku {}".format( - courseless_partner_sku, partner_sku - ) - logger.info(msg) - return switch_link_text, partner_sku @@ -215,7 +179,6 @@ def _find_seat_enrollment_toggle_sku(product, target_structure): return None -@newrelic.agent.function_trace() def attribute_cookie_data(basket, request): try: with transaction.atomic(): @@ -239,7 +202,6 @@ def attribute_cookie_data(basket, request): logger.exception('Error while attributing cookies to basket.') -@newrelic.agent.function_trace() def _referral_from_basket_site(basket, site): try: # There should be only 1 referral instance for one basket. @@ -250,7 +212,6 @@ def _referral_from_basket_site(basket, site): return referral -@newrelic.agent.function_trace() def _record_affiliate_basket_attribution(referral, request): """ Attribute this user's basket to the referring affiliate, if applicable. @@ -264,7 +225,6 @@ def _record_affiliate_basket_attribution(referral, request): referral.affiliate_id = affiliate_id -@newrelic.agent.function_trace() def _record_utm_basket_attribution(referral, request): """ Attribute this user's basket to UTM data, if applicable. @@ -288,7 +248,6 @@ def _record_utm_basket_attribution(referral, request): referral.utm_created_at = created_at_datetime -@newrelic.agent.function_trace() def basket_add_organization_attribute(basket, request_data): """ Add organization attribute on basket, if organization value is provided @@ -337,7 +296,6 @@ def basket_add_enterprise_catalog_attribute(basket, request_data): ) -@newrelic.agent.function_trace() def _set_basket_bundle_status(bundle, basket): """ Sets the basket's bundle status diff --git a/ecommerce/extensions/basket/views.py b/ecommerce/extensions/basket/views.py index bed34772314..f6a001c1b20 100644 --- a/ecommerce/extensions/basket/views.py +++ b/ecommerce/extensions/basket/views.py @@ -6,7 +6,6 @@ from urllib import urlencode import dateutil.parser -import newrelic.agent import waffle from django.http import HttpResponseBadRequest, HttpResponseRedirect from django.shortcuts import redirect, render @@ -104,7 +103,6 @@ class BasketSummaryView(BasketView): Display basket contents and checkout/payment options. """ - @newrelic.agent.function_trace() def _determine_product_type(self, product): """ Return the seat type based on the product class @@ -116,7 +114,6 @@ def _determine_product_type(self, product): seat_type = get_certificate_type_display_value(product.attr.seat_type) return seat_type - @newrelic.agent.function_trace() def _deserialize_date(self, date_string): date = None try: @@ -125,7 +122,6 @@ def _deserialize_date(self, date_string): pass return date - @newrelic.agent.function_trace() def _get_course_data(self, product): """ Return course data. @@ -196,7 +192,6 @@ def _get_course_data(self, product): 'course_end': course_end, } - @newrelic.agent.function_trace() def _process_basket_lines(self, lines): """Processes the basket lines and extracts information for the view's context. In addition determines whether: @@ -303,7 +298,6 @@ def _process_basket_lines(self, lines): return context_updates, lines_data - @newrelic.agent.function_trace() def _get_payment_processors_data(self, payment_processors): """Retrieve information about payment processors for the client side checkout basket. @@ -363,7 +357,6 @@ def get(self, request, *args, **kwargs): else: return super(BasketSummaryView, self).get(request, *args, **kwargs) - @newrelic.agent.function_trace() def get_context_data(self, **kwargs): context = super(BasketSummaryView, self).get_context_data(**kwargs) formset = context.get('formset', [])