Documentation
¶
Overview ¶
Package dbstats carries the connection-pool statistics the storage driver produces and the telemetry layer exports.
It exists to keep those two apart. The driver must not depend on Prometheus just to describe its own pool, and the telemetry layer must not depend on pgx to read it, so the shared vocabulary lives here and this package depends on nothing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PoolStats ¶
type PoolStats struct {
// Idle counts open connections not currently in use. Used counts those
// checked out. Constructing counts those being opened.
Idle, Used, Constructing int32
// MaxConns is the configured limit on open connections. A count of
// connections in use means nothing without knowing the limit.
MaxConns int32
// Acquires counts every successful request for a connection. EmptyAcquires
// counts how many had to wait for one to become available. CanceledAcquires
// counts how many gave up waiting before getting one. Read the last two
// together: as the pool degrades, EmptyAcquires falls while CanceledAcquires
// rises, so a deteriorating pool looks better if only the first is watched.
//
// EmptyWaitSeconds is the total time spent waiting (successful requests
// only). It includes opening new connections when necessary, so the full
// network handshake, TLS negotiation and authentication. Pools routinely
// replace old connections, so a baseline of wait time here is normal setup
// overhead, not queue contention.
Acquires, EmptyAcquires, CanceledAcquires int64
EmptyWaitSeconds float64
}
PoolStats is a snapshot of one connection pool, in primitives rather than a pgxpool type.
type PoolStatter ¶
PoolStatter is satisfied by the storage driver. ok is false if the pool isn't connected yet or has already been closed — an expected state, not an error.
Click to show internal directories.
Click to hide internal directories.