feat: Add db.driver.name spans to database integrations
#6082
1 issue
code-review: Found 1 issue (1 high)
High
Test assertion will fail: DB_DRIVER_NAME not set for parameter-less execute calls - `tests/integrations/asyncpg/test_asyncpg.py:557`
The new assertion assert data.get(SPANDATA.DB_DRIVER_NAME) == "asyncpg" will fail because _wrap_execute does not call _set_db_data() when len(args) <= 2. The test calls conn.execute("INSERT INTO ...") with only a query string (no parameters), so it goes through the code path at lines 76-88 in asyncpg.py which uses record_sql_queries but never sets DB_DRIVER_NAME. The span will be missing this attribute, causing the test to fail.
Duration: 1m 57s · Tokens: 1.2M in / 15.6k out · Cost: $2.82
Annotations
Check failure on line 557 in tests/integrations/asyncpg/test_asyncpg.py
sentry-warden / warden: code-review
Test assertion will fail: DB_DRIVER_NAME not set for parameter-less execute calls
The new assertion `assert data.get(SPANDATA.DB_DRIVER_NAME) == "asyncpg"` will fail because `_wrap_execute` does not call `_set_db_data()` when `len(args) <= 2`. The test calls `conn.execute("INSERT INTO ...")` with only a query string (no parameters), so it goes through the code path at lines 76-88 in asyncpg.py which uses `record_sql_queries` but never sets `DB_DRIVER_NAME`. The span will be missing this attribute, causing the test to fail.