Skip to content

Expose SQL query capture via govisual.WrapDriver#52

Merged
doganarif merged 1 commit into
mainfrom
feat/sql-capture
Jul 2, 2026
Merged

Expose SQL query capture via govisual.WrapDriver#52
doganarif merged 1 commit into
mainfrom
feat/sql-capture

Conversation

@doganarif

Copy link
Copy Markdown
Owner

The driver-level SQL hook has existed since the profiling work but was unreachable: it needed a *Profiler handle that only Wrap ever held. Recording now goes through the request context (profiling.RecordSQL pulls the profile from ctx and is a no-op without one), which makes the hook handle-free and safe to expose.

govisual.WrapDriver(d) wraps any database/sql driver; register it once, open the DB through it, and queries executed with the request's context show up on that request's profile — query text, duration, rows, error — feeding the existing per-request SQL view and the database-bottleneck analysis.

Tests cover recording through a real database/sql round trip against a fake driver, and the no-profile pass-through.

@doganarif doganarif merged commit 5f2aeb3 into main Jul 2, 2026
1 check passed
@doganarif doganarif deleted the feat/sql-capture branch July 2, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant