LabKit v2: postgres package
Overview
Implement the postgres package for LabKit v2 — a pgxpool-backed PostgreSQL connection pool that implements app.Component and automatically traces every query with OpenTelemetry spans.
Start(ctx) verifies connectivity and appears in the trace. The underlying *pgxpool.Pool is exposed for full pgx API access.
Example usage
db, _ := postgres.NewWithConfig(&postgres.Config{
DSN: "postgres://user:pass@localhost/mydb",
MaxConns: 20,
Tracer: tracer,
})
// db.Start(ctx) verifies connectivity and appears in the trace
pool := db.Pool() // *pgxpool.Pool — full pgx API available
Reference
- MR: gitlab-org/labkit!314
- Parent epic: gitlab-org/quality#341