You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I'd like to work on this if it's still open. I use the asyncpg integration at work.
I looked into how asyncpg sends transaction statements. Transaction.start(), commit() and rollback() call Connection.execute, which _wrap_execute already records as a span. The statements are:
BEGIN; / BEGIN ISOLATION LEVEL SERIALIZABLE READ ONLY; (with modifiers)
COMMIT;, ROLLBACK;
SAVEPOINT <id>;, RELEASE SAVEPOINT <id>;, ROLLBACK TO <id>;
My plan is to set db.operation.name on these spans in _wrap_execute, following the spec in getsentry/sentry-docs#15194 (statement name without arguments, BEGIN for BEGIN with modifiers), similar to what the Django integration does for commit/rollback spans. I'll add tests for each statement.
Two questions before I start:
Should this cover only transaction statements, or every query (SELECT, INSERT, ...)?
asyncpg sends ROLLBACK TO <id> without the SAVEPOINT keyword. Should the operation name be ROLLBACK TO SAVEPOINT to match the spec, or ROLLBACK TO as sent?
(I use a translator for English, so sorry if anything reads awkwardly.)
Activity
linear commentedon Oct 20, 2025
PY-1902
kbj804 commentedon Nov 24, 2026
Hi! I'd like to work on this if it's still open. I use the asyncpg integration at work.
I looked into how asyncpg sends transaction statements.
Transaction.start(),commit()androllback()callConnection.execute, which_wrap_executealready records as a span. The statements are:BEGIN;/BEGIN ISOLATION LEVEL SERIALIZABLE READ ONLY;(with modifiers)COMMIT;,ROLLBACK;SAVEPOINT <id>;,RELEASE SAVEPOINT <id>;,ROLLBACK TO <id>;My plan is to set
db.operation.nameon these spans in_wrap_execute, following the spec in getsentry/sentry-docs#15194 (statement name without arguments,BEGINfor BEGIN with modifiers), similar to what the Django integration does for commit/rollback spans. I'll add tests for each statement.Two questions before I start:
ROLLBACK TO <id>without theSAVEPOINTkeyword. Should the operation name beROLLBACK TO SAVEPOINTto match the spec, orROLLBACK TOas sent?(I use a translator for English, so sorry if anything reads awkwardly.)