Skip to content

feat(metrics): record terminal PostgreSQL session starts - #1013

Merged
bill-ph merged 2 commits into
mainfrom
codex/postgres-session-failure-page
Jul 30, 2026
Merged

feat(metrics): record terminal PostgreSQL session starts#1013
bill-ph merged 2 commits into
mainfrom
codex/postgres-session-failure-page

Conversation

@bill-ph

@bill-ph bill-ph commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • emit duckgres_postgres_session_start_total{org,outcome,reason} exactly once for each authenticated PostgreSQL session start
  • classify terminal server-side failures separately from client, lifecycle, cancellation, transport, and unknown failures
  • keep the retiring Flight path out of the new counter
  • document the metric contract and its bounded failure reasons

Why

The alerting follow-up needs a client-impact signal, not a CNPG component or capacity proxy. This counter records the final result after Duckgres has completed its internal session-start work, so the alert can require repeated failures and no successful start for the same organization.

Hard admission-policy rejections caused by an oversized client-requested worker are classified as client, while runtime worker exhaustion and admission timeouts remain capacity.

Rollout

Deploy this instrumentation before enabling the dependent charts alert. The metric is new and has no historical backfill; the dependent expression remains empty before this version is deployed.

Dependent charts PR: https://github.com/PostHog/charts/pull/13711

Validation

  • just lint
  • just test-unit
  • go test ./controlplane -count=1
  • just test-metrics
  • alert-specific tests were developed red-first, then passed after implementation

The broader just test-controlplane and Kubernetes-tagged run reached their Docker-backed cases; those cases could not run because the local OrbStack Docker socket is unavailable. The non-Docker packages and changed control-plane package passed.

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

Test Impact Plan

Deterministic summary of how this PR changes tests, CI runners, and coverage-risk signals.

Summary

Area Added Changed Deleted
Test files 0 2 0
E2E/journey files 0 0 0
Workflow files 0 0 0

Signals

  • Test cases: +7 / -2
  • Assertions: +10 / -5
  • Skips or known failures added: 0
  • Workflow continue-on-error added: 0
  • Workflow path filters added: 0
  • Test commands removed from justfile: 0
  • E2E/journey retry lines added: 0

Coverage risk: neutral or increased

No coverage-reduction warnings detected.

@bill-ph
bill-ph marked this pull request as ready for review July 30, 2026 09:36
@bill-ph
bill-ph merged commit 8dfe562 into main Jul 30, 2026
30 of 32 checks passed
@bill-ph
bill-ph deleted the codex/postgres-session-failure-page branch July 30, 2026 10:20
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