From af596a9d4908d450cfb7bdb07a5368f96e46037a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferenc=20G=C3=A9czi?= Date: Thu, 24 Aug 2023 10:00:00 +0000 Subject: [PATCH] fix(pep0249): Use the wrapped value in CTX instead of unwrapped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ferenc Géczi --- instana/instrumentation/pep0249.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/instana/instrumentation/pep0249.py b/instana/instrumentation/pep0249.py index d00814b85..b865eb5d4 100644 --- a/instana/instrumentation/pep0249.py +++ b/instana/instrumentation/pep0249.py @@ -37,6 +37,9 @@ def _collect_kvs(self, span, sql): logger.debug(e) return span + def __enter__(self): + return self + def execute(self, sql, params=None): active_tracer = get_active_tracer() @@ -103,6 +106,9 @@ def __init__(self, connection, module_name, connect_params): self._module_name = module_name self._connect_params = connect_params + def __enter__(self): + return self + def cursor(self, *args, **kwargs): return CursorWrapper( cursor=self.__wrapped__.cursor(*args, **kwargs),