From 53706488f509ebc07e9c4efe0a3cdd67ec9bd9ed Mon Sep 17 00:00:00 2001 From: Srikanth Chekuri Date: Fri, 15 Jul 2022 22:17:02 +0530 Subject: [PATCH] update pymongo instrumentation --- .../instrumentation/pymongo/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py b/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py index 171979dbfe..51c8d46913 100644 --- a/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/__init__.py @@ -225,20 +225,20 @@ def _instrument(self, **kwargs): failed_hook = kwargs.get("failed_hook", dummy_callback) # Create and register a CommandTracer only the first time - if self._commandtracer_instance is None: + if PymongoInstrumentor._commandtracer_instance is None: tracer = get_tracer(__name__, __version__, tracer_provider) - self._commandtracer_instance = CommandTracer( + PymongoInstrumentor._commandtracer_instance = CommandTracer( tracer, request_hook=request_hook, response_hook=response_hook, failed_hook=failed_hook, ) - monitoring.register(self._commandtracer_instance) + monitoring.register(PymongoInstrumentor._commandtracer_instance) # If already created, just enable it - self._commandtracer_instance.is_enabled = True + PymongoInstrumentor._commandtracer_instance.is_enabled = True def _uninstrument(self, **kwargs): - if self._commandtracer_instance is not None: - self._commandtracer_instance.is_enabled = False + if PymongoInstrumentor._commandtracer_instance is not None: + PymongoInstrumentor._commandtracer_instance.is_enabled = False