Skip to content

Commit a0f74ca

Browse files
Rm psycopg2 wrapt dep
1 parent ea8d73d commit a0f74ca

File tree

1 file changed

+3
-5
lines changed
  • instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2

1 file changed

+3
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@
106106
from typing import Collection
107107

108108
import psycopg2
109-
import wrapt
110109
from psycopg2.extensions import (
111110
cursor as pg_cursor, # pylint: disable=no-name-in-module
112111
)
@@ -168,10 +167,9 @@ def instrument_connection(
168167
enable_commenter: bool = False,
169168
commenter_options: dict = None,
170169
):
171-
if isinstance(connection, wrapt.ObjectProxy):
172-
# The connection is already instrumented from wrapt.wrap_function_wrapper
173-
# of the psycopg2 module's `connect` method by DB-API `wrap_connect`,
174-
# so the Psycopg2Instrumentor is marked as instrumenting.
170+
if self._is_instrumented_by_opentelemetry:
171+
# _instrument (via BaseInstrumentor) or instrument_connection (this)
172+
# was already called
175173
_logger.warning(
176174
"Attempting to instrument Psycopg connection while already instrumented"
177175
)

0 commit comments

Comments
 (0)