pooled adapter queries outside a tx (each takes a pool connection)
raw direct *sql.DB calls, with kinds: auth.session, auth.activity, security.column, security.row, probe.pg_proc (lookup ModeAuto only), keystore.validate
Connections used ≈ tx + pooled + raw
Pool log
dbtrace pool <name>: open in_use idle max opened=+N waits=+N wait_time=+D — opened/waits are deltas since last publish.
Limits
tx attribution is per request, assumes sequential use of a request's context
auth.activity runs detached after the response: not in the request's log line
BeginTx/CommitTx (manual tx) not counted; only RunInTransaction
Raw counters cover the hot paths listed above only (not login/OAuth/passkey/TOTP)
Package dbtrace counts database calls per request and logs the heavy ones.
It is off until Configure enables it; the hot-path helpers are no-ops for
contexts without a tracker.
Connection use per request ≈ tx + pooled + raw (each pooled/raw call takes
its own pool connection; calls inside RunInTransaction share the tx's).
Middleware tracks every request and logs those over the configured
thresholds once the handler returns. Options are read per request, so
Configure can toggle it at runtime. Raw calls made by detached goroutines
after the response (e.g. session activity) are not included in the log line.
type Options struct {
Enabled bool MinCalls int// log when tx+pooled+raw >= MinCalls MinDuration time.Duration// or when the request took at least this (0 = off) PoolLog bool// log pool deltas on each dbmanager metrics publish}