Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Enables opentracing parent calling saleor
Ben Flowersa2b464983467
diff --git a/saleor/graphql/views.py b/saleor/graphql/views.pyindex 8c404dca31..bf3931ad7d 100644--- a/saleor/graphql/views.py+++ b/saleor/graphql/views.py@@ -6,6 +6,7 @@ from typing import Any, Dict, List, Optional, Tuple, Unionimport opentracingimport opentracing.tags+from opentracing.propagation import Formatfrom django.conf import settingsfrom django.db import connectionfrom django.db.backends.postgresql.base import DatabaseWrapper@@ -130,7 +131,14 @@ class GraphQLView(View):return JsonResponse(data=result, status=status_code, safe=False)def handle_query(self, request: HttpRequest) -> JsonResponse:- with opentracing.global_tracer().start_active_span("http") as scope:+ tracer = opentracing.global_tracer()++ span_context = tracer.extract(+ format=Format.HTTP_HEADERS,+ carrier=request.headers+ )++ with tracer.start_active_span("http", child_of=span_context) as scope:span = scope.spanspan.set_tag(opentracing.tags.COMPONENT, "http")span.set_tag(opentracing.tags.HTTP_METHOD, request.method)