Skip to content

Instrument database pool roles - #7356

Draft
TheSentinel454 wants to merge 2 commits into
mainfrom
tornquist/database-pool-roles
Draft

Instrument database pool roles#7356
TheSentinel454 wants to merge 2 commits into
mainfrom
tornquist/database-pool-roles

Conversation

@TheSentinel454

Copy link
Copy Markdown
Contributor

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

Expose one closed physical Postgres pool-role vocabulary — writer,
reader, audit, and search — used only at pool construction and the
utilization-metrics boundary. Emit a fixed-cardinality role-labelled
contract (buzz_db_pool_connections{pool_role,state} plus
buzz_db_pool_configured{pool_role}) so all four roles are always present
and unconfigured optional pools report zero rather than disappearing.

The existing writer buzz_db_pool_* and reader buzz_db_read_pool_* gauges
are preserved unchanged for dashboard compatibility. Audit and search
keep cheap PgPool clones purely as statistics handles; service
ownership, pool capacities, timeouts, and query routing are unchanged,
and no aggregate deployment connection budget is enforced.

Document the new families in the Helm chart operator README and correct
the stale ARCHITECTURE.md claim that search indexing is an asynchronous
pipeline step — search_tsv is a generated column maintained on insert.

Signed-off-by: tornquist <tornquist@squareup.com>
Co-authored-by: Codex <noreply@openai.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is f038cbbb0d4092a72ffd93f17916f84d2b39bb43...b640e59d5bbf4c0708a5fe116f2017a7f2859076.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review b640e59d5bbf4c0708a5fe116f2017a7f2859076 to authorize a new review.
Any previous review applies only to its recorded range.

Signed-off-by: tornquist <tornquist@squareup.com>
Co-authored-by: Codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant