-
Notifications
You must be signed in to change notification settings - Fork 784
Open
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is neededinstrumentationtriaged
Description
Lines 126 to 141 in 2ee2cf3
class DatabaseApiIntegration(dbapi.DatabaseApiIntegration): | |
def wrapped_connection( | |
self, | |
connect_method: typing.Callable[..., typing.Any], | |
args: typing.Tuple[typing.Any, typing.Any], | |
kwargs: typing.Dict[typing.Any, typing.Any], | |
): | |
"""Add object proxy to connection object.""" | |
base_cursor_factory = kwargs.pop("cursor_factory", None) | |
new_factory_kwargs = {"db_api": self} | |
if base_cursor_factory: | |
new_factory_kwargs["base_factory"] = base_cursor_factory | |
kwargs["cursor_factory"] = _new_cursor_factory(**new_factory_kwargs) | |
connection = connect_method(*args, **kwargs) | |
self.get_connection_attributes(connection) | |
return connection |
When wrapping the connection, the default cursor_factory
is set for the connection, but the connection is returned as is rather than a proxy. Therefore, when a cursor is created with the connection_factory
argument passed, the instrumentation does not happen.
Steps to reproduce
Set up the Psycopg2Instrumentor, create a cursor passing the cursor_factory
argument, and run a query.
What is the expected behavior?
Spans produced/exported
What is the actual behavior?
No spans produced/exported
rogersnm
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is neededinstrumentationtriaged