Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Remove BasketSummaryView debug logging and traces
Browse files Browse the repository at this point in the history
LEARNER-5611
  • Loading branch information
jmyatt committed Jul 2, 2018
1 parent c6c5934 commit 2b64948
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 49 deletions.
42 changes: 0 additions & 42 deletions ecommerce/extensions/basket/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]]
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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


Expand Down Expand Up @@ -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():
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions ecommerce/extensions/basket/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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', [])
Expand Down

0 comments on commit 2b64948

Please sign in to comment.