Skip to content

Commit d76fa98

Browse files
authored
fix(django): Fix psycopg2 detection (#2593)
We were failing to detect built-in methods. isroutine() should cover both cases.
1 parent 64c42ca commit d76fa98

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sentry_sdk/integrations/django/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ def _set_db_data(span, cursor_or_db):
697697
is_psycopg2 = (
698698
hasattr(cursor_or_db, "connection")
699699
and hasattr(cursor_or_db.connection, "get_dsn_parameters")
700-
and inspect.isfunction(cursor_or_db.connection.get_dsn_parameters)
700+
and inspect.isroutine(cursor_or_db.connection.get_dsn_parameters)
701701
)
702702
if is_psycopg2:
703703
connection_params = cursor_or_db.connection.get_dsn_parameters()
@@ -706,7 +706,7 @@ def _set_db_data(span, cursor_or_db):
706706
hasattr(cursor_or_db, "connection")
707707
and hasattr(cursor_or_db.connection, "info")
708708
and hasattr(cursor_or_db.connection.info, "get_parameters")
709-
and inspect.isfunction(cursor_or_db.connection.info.get_parameters)
709+
and inspect.isroutine(cursor_or_db.connection.info.get_parameters)
710710
)
711711
if is_psycopg3:
712712
connection_params = cursor_or_db.connection.info.get_parameters()

0 commit comments

Comments
 (0)