Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Disable tracing of fast resolvers (#11031)
Tomasz Szymański38684d121c25
diff --git a/saleor/graphql/attribute/types.py b/saleor/graphql/attribute/types.pyindex b5de8b0b26..4156873454 100644--- a/saleor/graphql/attribute/types.py+++ b/saleor/graphql/attribute/types.py@@ -10,7 +10,6 @@ from ...core.permissions import (ProductPermissions,ProductTypePermissions,)-from ...core.tracing import traced_resolverfrom ..core.connection import (CountableConnection,create_connection_slice,@@ -72,7 +71,6 @@ class AttributeValue(ModelObjectType):model = models.AttributeValue@staticmethod- @traced_resolverdef resolve_input_type(root: models.AttributeValue, info):return (AttributesByAttributeId(info.context)diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.pyindex 68f2e201ce..d8e1ec9171 100644--- a/saleor/graphql/product/types/products.py+++ b/saleor/graphql/product/types/products.py@@ -906,7 +906,6 @@ class Product(ChannelContextTypeWithMetadata, ModelObjectType):return TaxType(tax_code=tax_data.code, description=tax_data.description)@staticmethod- @traced_resolverdef resolve_thumbnail(root: ChannelContext[models.Product], info, *, size=256, format=None):@@ -1187,7 +1186,6 @@ class Product(ChannelContextTypeWithMetadata, ModelObjectType):return convert_weight_to_default_weight_unit(root.node.weight)@staticmethod- @traced_resolverdef resolve_is_available_for_purchase(root: ChannelContext[models.Product], info):if not root.channel_slug:return None@@ -1205,7 +1203,6 @@ class Product(ChannelContextTypeWithMetadata, ModelObjectType):)@staticmethod- @traced_resolverdef resolve_available_for_purchase(root: ChannelContext[models.Product], info):if not root.channel_slug:return None@@ -1223,7 +1220,6 @@ class Product(ChannelContextTypeWithMetadata, ModelObjectType):)@staticmethod- @traced_resolverdef resolve_available_for_purchase_at(root: ChannelContext[models.Product], info):if not root.channel_slug:return Nonediff --git a/saleor/product/utils/availability.py b/saleor/product/utils/availability.pyindex a9f6266ace..db0e9f703d 100644--- a/saleor/product/utils/availability.py+++ b/saleor/product/utils/availability.py@@ -1,7 +1,6 @@from dataclasses import dataclassfrom typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union-import opentracingfrom django.conf import settingsfrom django_countries.fields import Countryfrom prices import MoneyRange, TaxedMoney, TaxedMoneyRange@@ -238,54 +237,53 @@ def get_variant_availability(country: Country,local_currency: Optional[str] = None,) -> VariantAvailability:- with opentracing.global_tracer().start_active_span("get_variant_availability"):- channel_slug = channel.slug- discounted = plugins.apply_taxes_to_product(- product,- get_variant_price(- variant=variant,- variant_channel_listing=variant_channel_listing,- product=product,- collections=collections,- discounts=discounts,- channel=channel,- ),- country,- channel_slug=channel_slug,- )- undiscounted = plugins.apply_taxes_to_product(- product,- get_variant_price(- variant=variant,- variant_channel_listing=variant_channel_listing,- product=product,- collections=collections,- discounts=[],- channel=channel,- ),- country,- channel_slug=channel_slug,- )+ channel_slug = channel.slug+ discounted = plugins.apply_taxes_to_product(+ product,+ get_variant_price(+ variant=variant,+ variant_channel_listing=variant_channel_listing,+ product=product,+ collections=collections,+ discounts=discounts,+ channel=channel,+ ),+ country,+ channel_slug=channel_slug,+ )+ undiscounted = plugins.apply_taxes_to_product(+ product,+ get_variant_price(+ variant=variant,+ variant_channel_listing=variant_channel_listing,+ product=product,+ collections=collections,+ discounts=[],+ channel=channel,+ ),+ country,+ channel_slug=channel_slug,+ )- discount = _get_total_discount(undiscounted, discounted)+ discount = _get_total_discount(undiscounted, discounted)- if local_currency:- price_local_currency = to_local_currency(discounted, local_currency)- discount_local_currency = to_local_currency(discount, local_currency)- else:- price_local_currency = None- discount_local_currency = None+ if local_currency:+ price_local_currency = to_local_currency(discounted, local_currency)+ discount_local_currency = to_local_currency(discount, local_currency)+ else:+ price_local_currency = None+ discount_local_currency = None- is_visible = (- product_channel_listing is not None and product_channel_listing.is_visible- )- is_on_sale = is_visible and discount is not None-- return VariantAvailability(- on_sale=is_on_sale,- price=discounted,- price_undiscounted=undiscounted,- discount=discount,- price_local_currency=price_local_currency,- discount_local_currency=discount_local_currency,- )+ is_visible = (+ product_channel_listing is not None and product_channel_listing.is_visible+ )+ is_on_sale = is_visible and discount is not None++ return VariantAvailability(+ on_sale=is_on_sale,+ price=discounted,+ price_undiscounted=undiscounted,+ discount=discount,+ price_local_currency=price_local_currency,+ discount_local_currency=discount_local_currency,+ )