Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Disable tracing of fast resolvers (#11031)

Tomasz Szymański38684d121c25
diff --git a/saleor/graphql/attribute/types.py b/saleor/graphql/attribute/types.py
index 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_resolver
from ..core.connection import (
CountableConnection,
create_connection_slice,
@@ -72,7 +71,6 @@ class AttributeValue(ModelObjectType):
model = models.AttributeValue
@staticmethod
- @traced_resolver
def 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.py
index 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_resolver
def 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_resolver
def 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_resolver
def 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_resolver
def resolve_available_for_purchase_at(root: ChannelContext[models.Product], info):
if not root.channel_slug:
return None
diff --git a/saleor/product/utils/availability.py b/saleor/product/utils/availability.py
index a9f6266ace..db0e9f703d 100644
--- a/saleor/product/utils/availability.py
+++ b/saleor/product/utils/availability.py
@@ -1,7 +1,6 @@
from dataclasses import dataclass
from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union
-import opentracing
from django.conf import settings
from django_countries.fields import Country
from 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,
+ )