Unify db connections, add otel to pool #1371
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
db.NewPool
*sql.DB
is needed,db.Open(pool)
can provide one. Connection pooling is still handled by thepgxpool.Pool
.Note
Centralizes Postgres connections via a shared pgxpool with OpenTelemetry, injects *sql.DB/pgxpool into services, and updates API, seeds, and tests to use the new pool and migration check.
db.NewPool
(pgxpool) anddb.Open
to obtain*sql.DB
; enable OTEL viaotelpgx
(traces + metrics).db.NewClient
to accept*sql.DB
instead of creating connections.POSTGRES_MAX_CONNECTIONS
andPOSTGRES_MIN_IDLE_CONNECTIONS
.db.NewPool
, open*sql.DB
, pass intohandlers.NewAPIStore
.utils.CheckMigrationVersion
now takes*sql.DB
(no internal open/close).handlers.NewAPIStore
signature updated to receive injected DB (*sql.DB
,*pgxpool.Pool
).packages/db/client
):NewClient
toNewClient(pool *pgxpool.Pool)
; remove internal pool/options and tx helpers.main
, open*sql.DB
, pass tohandlers.NewStore
; use shareddb.NewClient
with provided conn.cache.ErrNotInCache
sentinel error.db.NewPool
/db.Open
; update seed scripts and test helpers to use injected pool/clients.github.com/exaring/otelpgx
and related OTEL/pgx deps across modules.Written by Cursor Bugbot for commit 2109e4d. This will update automatically on new commits. Configure here.