Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add missing span in run_method_on_single_plugin in PluginManager (#6900)
Filip Owczarek4fa2c69e440d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e11f38a1d2..70c5d9cdfb 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,7 @@ All notable, unreleased changes to this project will be documented in this file.- Add query contains only schema validation - #6827 by @fowczarek- Add introspection caching - #6871 by @fowczarek- Refactor plugins manager(add missing tracing, optimize imports, drop plugins manager from settings) - #6890 by @fowczarek+- Add missing span in PluginManager - #6900 by @fowczarek### Breaking- Multichannel MVP: Multicurrency - #6242 by @fowczarek @d-wysockidiff --git a/saleor/plugins/manager.py b/saleor/plugins/manager.pyindex a243dcf3d5..05a9595c48 100644--- a/saleor/plugins/manager.py+++ b/saleor/plugins/manager.py@@ -94,14 +94,20 @@ class PluginsManager(PaymentInterface):method. If plugin doesn't have own implementation of expected method_name, itwill return previous_value."""- plugin_method = getattr(plugin, method_name, NotImplemented)- if plugin_method == NotImplemented:- return previous_value-- returned_value = plugin_method(*args, **kwargs, previous_value=previous_value)- if returned_value == NotImplemented:- return previous_value- return returned_value+ plugin_id = getattr(plugin, "PLUGIN_ID", "")+ with opentracing.global_tracer().start_active_span(+ f"{plugin_id}.{method_name}"+ ):+ plugin_method = getattr(plugin, method_name, NotImplemented)+ if plugin_method == NotImplemented:+ return previous_value++ returned_value = plugin_method(+ *args, **kwargs, previous_value=previous_value+ )+ if returned_value == NotImplemented:+ return previous_value+ return returned_valuedef change_user_address(self, address: "Address", address_type: Optional[str], user: Optional["User"]