Skip to content

Commit 0529154

Browse files
committed
Fix proxy issue
1 parent d632528 commit 0529154

File tree

1 file changed

+7
-6
lines changed
  • instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi

1 file changed

+7
-6
lines changed

instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def __init__(
405405
db_api_integration: DatabaseApiIntegration | None = None,
406406
):
407407
wrapt.ObjectProxy.__init__(self, connection)
408-
self.db_api_integration = db_api_integration
408+
self._self_db_api_integration = db_api_integration
409409

410410
def __getattribute__(self, name: str):
411411
if object.__getattribute__(self, name):
@@ -417,7 +417,8 @@ def __getattribute__(self, name: str):
417417

418418
def cursor(self, *args: Any, **kwargs: Any):
419419
return get_traced_cursor_proxy(
420-
self.__wrapped__.cursor(*args, **kwargs), self.db_api_integration
420+
self.__wrapped__.cursor(*args, **kwargs),
421+
self._self_db_api_integration,
421422
)
422423

423424
def __enter__(self):
@@ -569,20 +570,20 @@ def __init__(
569570
db_api_integration: DatabaseApiIntegration,
570571
):
571572
wrapt.ObjectProxy.__init__(self, cursor)
572-
self._cursor_tracer = CursorTracer[CursorT](db_api_integration)
573+
self._self_cursor_tracer = CursorTracer[CursorT](db_api_integration)
573574

574575
def execute(self, *args: Any, **kwargs: Any):
575-
return self._cursor_tracer.traced_execution(
576+
return self._self_cursor_tracer.traced_execution(
576577
self.__wrapped__, self.__wrapped__.execute, *args, **kwargs
577578
)
578579

579580
def executemany(self, *args: Any, **kwargs: Any):
580-
return self._cursor_tracer.traced_execution(
581+
return self._self_cursor_tracer.traced_execution(
581582
self.__wrapped__, self.__wrapped__.executemany, *args, **kwargs
582583
)
583584

584585
def callproc(self, *args: Any, **kwargs: Any):
585-
return self._cursor_tracer.traced_execution(
586+
return self._self_cursor_tracer.traced_execution(
586587
self.__wrapped__, self.__wrapped__.callproc, *args, **kwargs
587588
)
588589

0 commit comments

Comments
 (0)