mirror of
https://github.com/block/buzz.git
synced 2026-10-27 12:40:30 +00:00
Instrument database pool roles (#7356)
## What
Name the relay's four Postgres pool roles—writer, reader, audit, and
search—and export one fixed-cardinality utilization metric contract for
all of them. Existing writer and reader gauges remain unchanged.
## Why
Audit and search already use separate pools, but they are missing from
pool pressure telemetry. Operators cannot see all process-level
connection demand before setting a deployment-wide connection budget.
## How
A closed `DbPoolRole` vocabulary now labels
`buzz_db_pool_connections{pool_role,state}` and
`buzz_db_pool_configured{pool_role}`. The relay retains cheap pool
clones for statistics only; ownership, capacities, timeouts, query
routing, and failure behavior do not change. The docs also replace the
stale async search-index description with the generated-column behavior
used today.
This simplifies four ad hoc observability states into one bounded model
without adding a pool manager or changing service boundaries.
## Risk
Low to moderate. This changes relay metrics and pool construction
plumbing, but not SQL execution or routing. Legacy metric names remain
available for current dashboards.
## Testing
- Push gate at `3f5468a0463bdfc5879bcdd3878fa06b42ca84c2`: all 14 Rust
test lanes passed; desktop Tauri checks passed.
- Blox: `cargo test --workspace --all-targets` with repository-declared
Postgres services.
- Blox: `cargo clippy --workspace --all-targets -- -D warnings`.
- Blox: `cargo fmt --all -- --check`.
## Bigger picture
Aggregate deployment budget enforcement remains deferred. This PR
exposes the per-role facts that a later deployment-policy change can
consume.
Generated with Claude Code
---------
Signed-off-by: tornquist <tornquist@squareup.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -188,6 +188,39 @@ families remain temporarily for dashboard compatibility and are not part of
|
||||
that new-family budget. No `other` operation or request-controlled/sensitive
|
||||
label is valid.
|
||||
|
||||
### Physical database pool utilization and configuration contract
|
||||
|
||||
Every physical Postgres pool the relay owns reports current utilization,
|
||||
capacity, and configuration under role-labelled families. The role vocabulary
|
||||
is closed — `writer`, `reader`, `audit`, `search` — and all four roles are always
|
||||
present, so a series never appears or disappears when an optional pool is
|
||||
enabled or disabled. An unconfigured optional pool reports
|
||||
`buzz_db_pool_configured` `0` with zero utilization and capacity rather than
|
||||
going missing.
|
||||
|
||||
| Metric | Type | Labels |
|
||||
|--------|------|--------|
|
||||
| `buzz_db_pool_connections` | gauge | `pool_role`, `state` |
|
||||
| `buzz_db_pool_max_connections` | gauge | `pool_role` |
|
||||
| `buzz_db_pool_configured` | gauge | `pool_role`; `1` configured, `0` not configured |
|
||||
|
||||
States are `idle` and `active`; their sum is the pool's current size.
|
||||
`buzz_db_pool_max_connections` reports capacity separately, so summing the
|
||||
connections family counts each current connection exactly once. The three
|
||||
families are fixed at 16 raw Prometheus series per pod (`4 × 2` current
|
||||
utilization plus `4` maximum capacity plus `4` configured). The `audit` and
|
||||
`search` roles are statistics-only: pool ownership, capacities, timeouts, and
|
||||
query routing are unchanged, and these roles emit no acquisition telemetry.
|
||||
|
||||
The pre-existing unlabelled `buzz_db_pool_*` (writer) and `buzz_db_read_pool_*`
|
||||
(reader) gauges are still exported unchanged for dashboard compatibility. The
|
||||
reader family remains absent when no read replica is configured; use
|
||||
`buzz_db_pool_configured{pool_role="reader"}` for the explicit signal.
|
||||
|
||||
Pool sizing and the aggregate connection budget across all four roles remain
|
||||
deployment configuration concerns. The relay does not enforce a combined
|
||||
connection ceiling.
|
||||
|
||||
## Relay Pod extensions
|
||||
|
||||
The chart exposes narrow extension points for init containers, volumes, relay
|
||||
|
||||
Reference in New Issue
Block a user