Add production features: slog adapter, scan helpers, slow query logging, pool stats, tracer passthrough, test tx isolation
Some checks failed
CI / test (push) Failing after 13s
Some checks failed
CI / test (push) Failing after 13s
- slog.go: SlogLogger adapts *slog.Logger to dbx.Logger interface - scan.go: Collect[T] and CollectOne[T] generic helpers using pgx.RowToStructByName - cluster.go: slow query logging via Config.SlowQueryThreshold (Warn level in queryEnd) - stats.go: PoolStats with Cluster.Stats() aggregating pool stats across all nodes - config.go/node.go: NodeConfig.Tracer passthrough for pgx.QueryTracer (OpenTelemetry) - options.go: WithSlowQueryThreshold and WithTracer functional options - dbxtest/tx.go: RunInTx runs callback in always-rolled-back transaction for test isolation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
12
AGENTS.md
12
AGENTS.md
@@ -11,17 +11,21 @@ Universal guide for AI coding agents working with this codebase.
|
||||
```
|
||||
dbx/ Root — Cluster, Node, Balancer, retry, health, errors, tx, config
|
||||
├── dbx.go Interfaces: Querier, DB, Logger, MetricsHook
|
||||
├── cluster.go Cluster — routing, write/read operations
|
||||
├── node.go Node — pgxpool.Pool wrapper with health state
|
||||
├── cluster.go Cluster — routing, write/read operations, slow query logging
|
||||
├── node.go Node — pgxpool.Pool wrapper with health state, tracer passthrough
|
||||
├── balancer.go Balancer interface + RoundRobinBalancer
|
||||
├── retry.go retrier — exponential backoff with jitter and node fallback
|
||||
├── health.go healthChecker — background goroutine pinging nodes
|
||||
├── tx.go RunTx, RunTxOptions, InjectQuerier, ExtractQuerier
|
||||
├── errors.go Error classification (IsRetryable, IsConnectionError, etc.)
|
||||
├── config.go Config, NodeConfig, PoolConfig, RetryConfig, HealthCheckConfig
|
||||
├── options.go Functional options (WithLogger, WithMetrics, WithRetry, etc.)
|
||||
├── options.go Functional options (WithLogger, WithMetrics, WithRetry, WithTracer, etc.)
|
||||
├── slog.go SlogLogger — adapts *slog.Logger to dbx.Logger
|
||||
├── scan.go Collect[T], CollectOne[T] — generic row scan helpers
|
||||
├── stats.go PoolStats — aggregate pool statistics via Cluster.Stats()
|
||||
└── dbxtest/
|
||||
└── dbxtest.go Test helpers: NewTestCluster, TestLogger
|
||||
├── dbxtest.go Test helpers: NewTestCluster, TestLogger
|
||||
└── tx.go RunInTx — test transaction isolation (always rolled back)
|
||||
```
|
||||
|
||||
## Routing architecture
|
||||
|
||||
Reference in New Issue
Block a user