Documentation
¶
Overview ¶
Package sqlx wires database/sql to OpenTelemetry via XSAM/otelsql.
Two things matter here and only one is obvious. The obvious one is query spans. The less obvious one is RegisterDBStatsMetrics: connection-pool exhaustion presents as "the database is slow" while the database sits idle, and the pool gauges are the only signal that distinguishes those two.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Open ¶
Open returns an instrumented *sql.DB and a close function.
Use the returned func instead of db.Close(): it also unregisters the pool metric callback, which otherwise keeps polling a closed pool for the life of the process.
driverName is the registered database/sql driver (e.g. "pgx"); system is the semconv value for it (e.g. "postgresql"). Pool sizing stays with the caller — SetMaxOpenConns and friends are workload-specific, and a library guessing them causes exactly the exhaustion these metrics exist to reveal.
Types ¶
This section is empty.