Skip to content

Add authored notebook templates for the PostgreSQL-only alert families (#4223) - #4419

Merged
erikdarlingdata merged 2 commits into
devfrom
fix/4223-notebook-postgres-families
Sep 26, 2026
Merged

erikdarlingdata merged 2 commits into
devfrom
fix/4223-notebook-postgres-families

Conversation

@erikdarlingdata

@erikdarlingdata erikdarlingdata commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Refs #4223.

Why

The three PostgreSQL-only alert families — Wraparound Risk, Vacuum Horizon Blocked, and Replication Slot Retention — still opened the mechanical fallback notebook (a plain list of section reads) when an alert fired. This gives each family an authored notebook instead: a header, status, its own drill-down reads, and a 24h trend panel.

What changes

New file AlertNotebookEndpoint.Templates.Postgres.cs (Darling/PerformanceMonitor.Darling.Service/), three builders registered as one row each in s_authoredTemplates:

Family (metric) Template id Cells
PostgreSQL Wraparound Risk authored/pg-wraparound Header, Status, get_pg_wraparound_risk, get_pg_autovacuum_health (limit 20), 24h trend of pg_xids_remaining (min), database-filtered
PostgreSQL Vacuum Horizon Blocked authored/pg-xmin-horizon Header, Status, get_pg_xmin_horizon, get_pg_session_states (limit 25), 24h trend of pg_xmin_age (max), no database filter — pg_xmin_horizon's only dimension is source
PostgreSQL Replication Slot Retention authored/pg-replication-slot Header, Status, get_pg_replication_slots, get_pg_replication_stats (limit 25), 24h trend of pg_slot_retained_wal_bytes (max), database-filtered

Each family's second read is the mechanical map's own second section for that metric (DarlingTriageEndpoint.cs), carried forward as an authored read cell.

The three primary reads (get_pg_wraparound_risk, get_pg_xmin_horizon, get_pg_replication_slots) declare no limit param in their catalog entry, so they're added to s_authoredLimitlessTrendReads alongside get_deadlock_trend. That set was private; widened to internal so the shared budget theory (AlertNotebookAuthoredTemplateTests.Budget_ReadCellsHaveLimitsExceptTheTrendRead...) checks membership in the real exemption set instead of hardcoding get_deadlock_trend by name — that hardcode would have false-failed on this PR's reads, so the shared test now generalizes correctly for any future exempt read too.

A new PgGaugeTimelinePanel helper (distinct from the shared TimelinePanel) builds the 24h gauge trend: no annotations key and a caller-supplied aggregate, since none of these three sources are per-event/count measures with a catalog annotation source — TimelinePanel hard-codes aggregate: "count" and always attaches an annotation, which doesn't fit a gauge.

Darling.Tests/AlertNotebookTemplatePostgresTests.cs (new, 9 tests): routing for all three metrics, the exact cell list/types/reads/params/trend source-measure-aggregate per family, and a no-matched-incident degrade (same cell count) for each. The shared theories in AlertNotebookAuthoredTemplateTests (data-driven off the registration table) already cover validation, dispatch, compose-catalog, budget, binding and viz for these three metrics with no edits needed there beyond the exemption-set generalization above.

Test plan

  • RED on origin/dev (5899b85): all 9 new tests fail — AuthoredTemplate(metric) returns null for all three metrics (no row registered), so .Value on the null result throws.
  • GREEN on this branch: AlertNotebookTemplatePostgresTests 9/9, AlertNotebookAuthoredTemplateTests 56/56, AlertNotebookEndpointTests 29/29, DocCommentHygieneTests 77/77 — all run in-process on macOS (pure, no live PG needed).
  • Darling.Tests.csproj and Lite.Tests.csproj both build 0 errors (-p:EnableWindowsTargeting=true); both target net10.0-windows and can't run here — CI decides them.
  • Did not run the full suite (out of time budget); ran the four template and notebook test classes plus the new file.

CHANGELOG entry

SECTION: Added
ENTRY:

#4223)

PostgreSQL Wraparound Risk, PostgreSQL Vacuum Horizon Blocked and
PostgreSQL Replication Slot Retention now open an authored notebook
instead of the mechanical section-list fallback: header, status, the
family's primary reads, and a 24h gauge trend panel.

Widens s_authoredLimitlessTrendReads to internal so the shared budget
theory can check the exemption set instead of hardcoding one read
name.
@erikdarlingdata
erikdarlingdata marked this pull request as ready for review September 26, 2026 14:06
@erikdarlingdata
erikdarlingdata merged commit 99aba09 into dev Sep 26, 2026
17 of 18 checks passed
@erikdarlingdata
erikdarlingdata deleted the fix/4223-notebook-postgres-families branch September 26, 2026 14:06
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