-
Notifications
You must be signed in to change notification settings - Fork 172
Closed as not planned
Labels
bugBug related to the Logfire Python SDKBug related to the Logfire Python SDK
Description
Description
I'm still trying to get the exact repro, but I cannot instrument psycopg2 and get results when I use from psycopg2.extras import RealDictCursor
I am using the instrumentation, BUT when I go to run it, no values show up for cursors that go through that path.
import logfire
import psycopg2 as pg
from psycopg2.extras import RealDictCursor
logfire.instrument_psycopg()
conn = pg.connect()
def get_plain_cursor(conn):
return conn.cursor()
def get_cursor(conn):
return conn.cursor(cursor_factory=RealDictCursor)
def run_query(cur, query: str, args=None):
try:
if isinstance(args, tuple):
cur.execute(query, args)
elif isinstance(args, list):
cur.executemany(query, args)
else:
cur.execute(query)
except Exception as e:
logger.error("Failed to run query", error=e)
raise e
with get_plain_cursor(conn) as pc:
run_query(pc, "SELECT 1")
# this shows the select query in logfire
with get_cursor(conn) as pc:
run_query(pc, "SELECT 1")
# this does NOT show the select query
Python, Logfire & OS Versions, related packages (not required)
No response
Metadata
Metadata
Assignees
Labels
bugBug related to the Logfire Python SDKBug related to the Logfire Python SDK