Skip to content

v3.0.0 fix: preserve pool-wait alert during collector failure - #351

Merged
djh58 merged 23 commits into
3.x.xfrom
djh58/prism-b-pool-exhaustion-alert
Sep 14, 2026
Merged

djh58 merged 23 commits into
3.x.xfrom
djh58/prism-b-pool-exhaustion-alert

Conversation

@djh58

@djh58 djh58 commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

Shared database-pool exhaustion can fail collection and stall the health publisher while instrumented acquisitions continue recording waits. Removing only the collector guard leaves the pool histogram cached and repeatedly resets the alert's three-minute dwell when that body becomes stale.

This reads the pool histogram live on each scrape using one coherent registry snapshot, replacing its cached HELP/TYPE, buckets, count and sum without duplicates. Only PrismDatabasePoolWaitHigh changes its gates: a successful scrape (up == 1) replaces collector and cached-body availability. Its p99 threshold above 0.5 seconds, five-minute window, minimum ten acquisitions per instance, three-minute dwell and alert labels remain unchanged. Other cached measurements retain their existing freshness and unknown-data contracts; acquisition, cancellation, ACK and payout behavior are unchanged.

Deploy the live-histogram producer to every coordinator target before activating this expression. Older producers still cache pool observations, so their successful scrapes do not establish the new freshness contract. Generated artifacts were regenerated against the pinned read-only template snapshot.

Validation on the pushed tree:

  • 24 metrics unit tests, 12 observability/inventory tests and 4 allocation tests pass; formatting and Clippy pass.
  • Two disposable PostgreSQL tests pass. The new real HTTP test holds all shared pool connections for over 33 seconds while real ledger and collector acquisitions cancel, follows the publisher's actual SQL dependency order through a stale-body interval, checks live histogram updates and verifies recovery to a valid zero-row collection. It isolates those dependencies without a node or mining workload.
  • The old runtime fails the new HTTP count assertion and both stale/concurrent histogram tests; these are assertion failures, not setup failures.
  • Promtool 3.14.0 passes 28 expressions, 73 scenarios, 145 expression assertions and 86 alert assertions, including sustained publication stalls, collector failure, low waits, missing/frozen samples, recovery and per-instance matching/count isolation. The original complete rule fails both required positive scenarios in the built-in negative control. CI now runs this suite with a pinned, checksum-verified promtool.
  • Both generators check cleanly; deployment rendering passes ten flag combinations. Full source-rule and rendered-YAML comparison against the merged parent permits only this pool rule's expression/description change.

Landing order was #334 → #343 → #351; #334 and #343 are merged, and this PR now targets 3.x.x. Append-only merges preserve review history; #345's cancellation producer remains unchanged. The publisher fix is 0bee2ef, included in pushed reconciliation head c703f3fd4daf8a0c95dd462d8a791861a93dabd4. Both final-head CI runs 34878673268 and 34878672937 passed without retry, including all 132 required gated tests. Focused Fable verification and thermo verification found no defects on this head, with independent positive and negative controls. The coordinator closeout records nonblocking maintenance notes and the mandatory producer-first rollout prerequisite; prior frozen-head reviews are not credited as verification of the runtime fix.

Refs #336.

Describe metrics collection and instrumented ledger transaction pool acquisition, retaining query/advisory-lock/read-gate exclusions and the five no-replacement dispositions. Regenerate migration tables and deployment patch from the verified frozen snapshot; all alert behavior is unchanged.
Preserve the updated base alert specifications and regenerate the deployment patch from the verified frozen snapshot. Clarify that rollup worker transactions, public API queries and other traffic outside instrumented acquisition paths remain untimed; retain all alert expressions and thresholds.
PR #333 intentionally added the ledger-outcome-unknown rejection label and a producer contract test. Add exactly that sample to the older exposition fixture from #344, retaining the byte-for-byte equality assertion and leaving runtime behavior unchanged.
Remove only the collector-availability gate; preserve snapshot freshness, sample sufficiency, thresholds, duration and labels. Add bounded PromQL scenarios with per-instance assertions, recovery and the old-expression negative control.

Refs #336. Landing depends on #334 and reconciliation with #343 and #345.
The native registry declares two database wait families, but nothing in
the ledger observed either one: advisory-lock waits had no observations
at all, and pool acquisition counted only the metrics collector's own.
ORDER_LOCK contention, which serializes every share acknowledgement, was
therefore invisible in production and in qualification.

Give Ledger an optional metrics handle, supplied by the new
connect_with_metrics; connect keeps its signature and passes None, so the
tools and tests that connect without a registry are unchanged and record
nothing. The coordinator passes its own handle.

Route every advisory lock through the existing lock() helper, now timing
the pg_advisory_xact_lock statement alone, and every ledger transaction
through a new begin() helper that times pool acquisition alone. begin()
is Pool::begin split in two around the timer, down to its sqlx::Error
return type, so both helpers are drop-in replacements and every call
site's `?` converts exactly as before. Leaving the BEGIN round trip
outside the timer keeps the pool series meaning what the collector
already records. Errors, including a lock_timeout expiry, propagate
unchanged and record as failure.

A drop guard records a wait abandoned by cancellation as a failure with
its elapsed time, so a cancelled wait stays distinct from one that never
happened. Completing the wait takes the handle out of the guard, so a
wait is recorded exactly once. The metrics mutex is taken only after the
wait has ended, never across an await, so rendering cannot queue behind a
contended lock; a guard held across the await would also make the future
!Send and fail to compile in the spawned share path.

The CPFP funding lock has no LockKind value and stays unobserved; an
unmapped key trips a debug assertion rather than borrowing another lock's
label.

Refs #328.
Two gated PostgreSQL tests and one source invariant.

The first attaches a registry and drives each outcome against a real
database: the migration lock from schema creation, a share append taking
ORDER_LOCK once, a second session holding ORDER_LOCK past a 200 ms
lock_timeout so the append fails with SQLSTATE 55P03 and records one
failure of at least that duration, an append cancelled mid-wait
recording its partial wait and no more, the settlement lock through
save_job, five transactions each observing one pool acquisition plus the
collector's own unchanged, a pool acquisition cancelled while every
connection is held, and a closed pool recording an acquisition failure.

The second runs the same sequence on a ledger with no handle and asserts
that results and error codes, 55P03 included, are what they are at the
base. It deliberately makes no assertion about a registry: one no ledger
can reach has nothing to record into and could not fail the test.

The third walks the ledger sources recursively and fails if a
transaction begins outside the timed helper or a second
pg_advisory_xact_lock statement appears, so a new call site, including
one in a nested module directory, cannot silently stop being observed.

Refs #328.
The two database wait families now say what they measure and who records
them: pool acquisition excludes transaction BEGIN and the queries that
follow, and advisory-lock timing covers one pg_advisory_xact_lock round
trip for the migration, order and settlement locks. Both record a wait
abandoned by cancellation as a failure, except the collector's own
acquisitions, which keep reporting cancellation through collector status
rather than inventing a completed wait.

The follow-up ownership and alert-migration notes no longer describe
either family as unpopulated, and record that PrismDatabasePoolWaitHigh
now evaluates ledger acquisitions while its description still predates
this change. No alert rule or digest input changes.

Refs #328.
PrismDatabasePoolWaitHigh is gated on collector_available for the database
collector. That collector acquires from the same pool as the ledger, so
sustained pool exhaustion times out its own acquisition, zeroes the gauge and
suppresses the rule exactly while the ledger histogram is recording the waits
that should fire it.

The gate cost nothing before this branch, because the family carried no samples
during such an outage. It does now. The rule itself cannot change here: its file
feeds the alert specification digest embedded in the deployment patch, which can
only be regenerated from the frozen template. #336 tracks that work; this records
the interaction where operators read it.

Refs #328.
@djh58

djh58 commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

Adversarial review checkpoint for head af0dea1e4e7399fbeb0b6f48033f147f5556dec2 (merge-base b8b72f8 on 3.x.x). Frozen worktree; independent runs only.

Verified

  • Change is exactly the removal of the collector_available{collector="database"} == 1 term from PrismDatabasePoolWaitHigh; thresholds (p99 > 0.5 s, ≥ 10 attempts in 5 m, for 3 m), labels and error states unchanged. Digest regenerated; regenerating from the pinned frozen template reproduces the patch byte-for-byte; --check and the render/apply test pass.
  • PromQL suite executed independently with promtool 3.14.0 (obtained for this review): 28 expressions, 67 scenarios, 128 expression assertions and 70 alert assertions pass, including the new pool-wait scenarios that evaluate the removed gate alongside the new expression to show the old false negative.
  • Attacked and held: real zero (healthy low waits → 0, not absent); no/zero/frozen observations never fabricate a percentile (sample guard, tested at 9 vs 10 attempts); per-instance counting (peers, other job/network cannot supply counts or freshness); recovery drains over the 5 m window; frozen counters age out; stale-snapshot recovery restarts the dwell; a collector-only cancellation records a failure observation only when the acquire itself was cancelled (v3.0.0 fix: record cancelled collector pool acquisitions #345), so a slow query after a fast acquire cannot fabricate a wait.

Finding 1 (major for this PR's stated goal): the remaining freshness gate re-suppresses the alarm during sustained pool exhaustion.
FILE: docs/prism-native-alert-rules.json (pool-wait expr, the metrics_snapshot_available == 1 and metrics_snapshot_stale == 0 terms); producer path crates/qbit-prism-server/src/server.rs:234-275 and src/coordinator.rs:1242+.
SCENARIO: the health publisher ticks every 2 s and each iteration awaits coordinator.health(), which calls ledger.payout_revision() → fetch_one(&pool) on the same pool (acquire timeout 15 s), then heartbeat() and prune_expired_jobs() on that pool. With the pool exhausted, every publication is delayed by up to 15 s and each loop iteration takes ~45 s, while the freshness budget is max(3 × PRISM_HEALTH_REFRESH_SECONDS, 15 s) = 15 s by default. So metrics_snapshot_stale is 1 for roughly two thirds of the time exactly while the histogram is recording the waits, and a for: 3m rule that must hold at every evaluation effectively cannot fire — the same self-referential suppression #336 removed for the collector gate. The new "stale snapshot" scenarios assert no alert, which codifies this rather than catching it.
Why the gate is not needed here: qbit_prism_database_pool_acquire_seconds is a live registry histogram recorded at scrape time, not a cached-snapshot gauge; the project's own rule guidance keeps scrape-time runtime signals evaluable while the body publisher is stale (PrismRuntimeLagHigh does exactly that).
Bounded fix: drop the two snapshot-freshness terms from this rule (keep the sample guard), regenerate the digest, and flip the "stale snapshot" / "unpublished snapshot" / "missing freshness" scenarios to expect firing when waits are slow (freshness of body gauges remains covered by the snapshot alerts). Alternative, if the gate must stay: bound the publisher's database reads independently of the pool (own short timeout) so freshness cannot collapse under exhaustion, and document that.

Finding 2 (minor, cross-PR): the inherited description still says "collector availability remains a separate alert guard"; #343 owns the wording and must reconcile it and regenerate the shared patch before or after this lands (both PR bodies already state this).

This checkpoint does not override the #334 landing hold and takes no merge action.

@djh58

djh58 commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

Thermo-nuclear (code-quality) lane checkpoint for head af0dea1e4e7399fbeb0b6f48033f147f5556dec2 against base b8b72f847bccc83755df6c9b5b108c8ebe7b5383, reviewed from an isolated export. This lane only; findings are against this SHA and do not validate the later stack integration.

Executed here

  • scripts/test_prism_alert_promql.py with promtool 3.14.0: 28 expressions; 67 scenarios; 128 expression assertions; 70 alert assertions passed.
  • Negative control: the same scripts against a scratch copy of the base (old gated expression) fail the two positive scenarios (alert expected at 6m, none fired), so the new scenarios genuinely exercise the removed gate.
  • Both generators --check clean; patch delta is exactly the pool-wait expr plus the specification digest; for, thresholds, window, sample floor, labels and no-data/error policy unchanged.
  • Source check: collector invalidation clears the candidate/RSS gauges only; the pool histogram is event-driven, so dropping the collector gate cannot promote an unknown measurement while the snapshot availability/staleness gates remain.

Findings

  1. The rule's own description in docs/prism-native-alert-rules.json still says "collector availability remains a separate alert guard" although this PR removes that guard from the expression; the wording this PR defers to in v3.0.0 docs: correct pool-acquire alert measurement boundaries #343 keeps the same sentence, so the stacked result stays inconsistent, and docs/prism-rust-migration.md:282 reads the same way. Since this PR changes the guard, the sentence should change with it (e.g. "collector availability is alerted separately by the collector-unavailable rule and does not gate this rule"), then regenerate the patch and re-run --check. Docs-only.
  2. The PromQL suite is not run in CI (no promtool step in .github/workflows/ci.yml), so the 26 new scenarios and the negative control only run on author/reviewer machines. Recommend a pinned-promtool CI step or a gated-test manifest entry; pre-existing gap, now load-bearing for this change.
  3. Optional: pool_wait_tests and test_prism_alert_promql.py each build the alert entry {"alert", "(expr) > 0", "for", "labels"} and assert gt/0; one shared helper is equivalent and removes the duplicate. The Python scenario module is justified because the JSON loader wraps expectations in sum() and supports one eval time; a short docstring saying so would help.

Landing note: #343 and this PR touch the same rule object and the same digest line, so one regeneration after both is required regardless; that does not resolve finding 1 by itself. No blocking correctness finding for the expression change.

@djh58
djh58 changed the base branch from 3.x.x to djh58/prism-b-alert-wording September 14, 2026 17:11
djh58 and others added 7 commits September 14, 2026 13:17
The native registry declares two database wait families, but nothing in
the ledger observed either one: advisory-lock waits had no observations
at all, and pool acquisition counted only the metrics collector's own.
ORDER_LOCK contention, which serializes every share acknowledgement, was
therefore invisible in production and in qualification.

Give Ledger an optional metrics handle, supplied by the new
connect_with_metrics; connect keeps its signature and passes None, so the
tools and tests that connect without a registry are unchanged and record
nothing. The coordinator passes its own handle.

Route every advisory lock through the existing lock() helper, now timing
the pg_advisory_xact_lock statement alone, and every ledger transaction
through a new begin() helper that times pool acquisition alone. begin()
is Pool::begin split in two around the timer, down to its sqlx::Error
return type, so both helpers are drop-in replacements and every call
site's `?` converts exactly as before. Leaving the BEGIN round trip
outside the timer keeps the pool series meaning what the collector
already records. Errors, including a lock_timeout expiry, propagate
unchanged and record as failure.

A drop guard records a wait abandoned by cancellation as a failure with
its elapsed time, so a cancelled wait stays distinct from one that never
happened. Completing the wait takes the handle out of the guard, so a
wait is recorded exactly once. The metrics mutex is taken only after the
wait has ended, never across an await, so rendering cannot queue behind a
contended lock; a guard held across the await would also make the future
!Send and fail to compile in the spawned share path.

The CPFP funding lock has no LockKind value and stays unobserved; an
unmapped key trips a debug assertion rather than borrowing another lock's
label.

Refs #328.
Two gated PostgreSQL tests and one source invariant.

The first attaches a registry and drives each outcome against a real
database: the migration lock from schema creation, a share append taking
ORDER_LOCK once, a second session holding ORDER_LOCK past a 200 ms
lock_timeout so the append fails with SQLSTATE 55P03 and records one
failure of at least that duration, an append cancelled mid-wait
recording its partial wait and no more, the settlement lock through
save_job, five transactions each observing one pool acquisition plus the
collector's own unchanged, a pool acquisition cancelled while every
connection is held, and a closed pool recording an acquisition failure.

The second runs the same sequence on a ledger with no handle and asserts
that results and error codes, 55P03 included, are what they are at the
base. It deliberately makes no assertion about a registry: one no ledger
can reach has nothing to record into and could not fail the test.

The third walks the ledger sources recursively and fails if a
transaction begins outside the timed helper or a second
pg_advisory_xact_lock statement appears, so a new call site, including
one in a nested module directory, cannot silently stop being observed.

Refs #328.
The two database wait families now say what they measure and who records
them: pool acquisition excludes transaction BEGIN and the queries that
follow, and advisory-lock timing covers one pg_advisory_xact_lock round
trip for the migration, order and settlement locks. Both record a wait
abandoned by cancellation as a failure, except the collector's own
acquisitions, which keep reporting cancellation through collector status
rather than inventing a completed wait.

The follow-up ownership and alert-migration notes no longer describe
either family as unpopulated, and record that PrismDatabasePoolWaitHigh
now evaluates ledger acquisitions while its description still predates
this change. No alert rule or digest input changes.

Refs #328.
PrismDatabasePoolWaitHigh is gated on collector_available for the database
collector. That collector acquires from the same pool as the ledger, so
sustained pool exhaustion times out its own acquisition, zeroes the gauge and
suppresses the rule exactly while the ledger histogram is recording the waits
that should fire it.

The gate cost nothing before this branch, because the family carried no samples
during such an outage. It does now. The rule itself cannot change here: its file
feeds the alert specification digest embedded in the deployment patch, which can
only be regenerated from the frozen template. #336 tracks that work; this records
the interaction where operators read it.

Refs #328.
@kiwidream

Copy link
Copy Markdown
Member

Heads-up from a review of #334: removing the collector-availability gate may not be sufficient on its own. A second mechanism suppresses this alert during the same incident.

The metrics body an exposition scrape returns is the last published snapshot, and publication happens inside the health loop in server.rs. One iteration of that loop does three things that acquire from the ledger pool:

  1. coordinator.health(), which calls ledger.payout_revision() straight off the pool;
  2. ledger.heartbeat(health), after the publication;
  3. ledger.prune_expired_jobs(), after that.

The pool's acquire_timeout is 15 seconds, so under sustained exhaustion each of those can block for up to 15 seconds and the loop's period stretches toward ~45 seconds, against a health_stale_after() of 15 seconds (max(PRISM_HEALTH_REFRESH_SECONDS * 3, 15)).

The snapshot is then marked stale between publications, and the rule's qbit_prism_metrics_snapshot_stale == 0 term drops out and restarts the 3-minute for dwell. So the alert cannot stay true long enough to fire during exactly the exhaustion it is meant to detect, independently of the collector_available gate.

Worth checking against this branch before it lands: either publish the event observations independently of the database-bound loop, or make the freshness gate tolerate a publication delay that is itself a symptom of the condition being alerted on.

Raised by the automated reviewer on #334 and verified in code here; recorded on #336. Nothing in #334 changes this behaviour, which predates it.

@djh58
djh58 changed the base branch from djh58/prism-b-alert-wording to 3.x.x September 14, 2026 18:05
@djh58

djh58 commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

The publisher coupling you identified is addressed in 0bee2ef, pushed in head c703f3fd4daf8a0c95dd462d8a791861a93dabd4. The pool histogram is now overlaid from one live registry read on every scrape; the pool rule uses successful-scrape availability while cached gauges retain their original freshness protections.

A disposable PostgreSQL regression exercises the publisher's real SQL dependency order while all shared-pool connections are held, and real HTTP scrapes see new ledger and collector cancellation observations across a stale-body interval. That test passes with the fix and fails against the old runtime because the HTTP count remains zero; the original complete alert rule also fails the sustained positive PromQL cases. Final CI and focused review of this pushed producer change are still pending.

@djh58

djh58 commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

Thermo-nuclear (code-quality) delta checkpoint for head c703f3fd4daf8a0c95dd462d8a791861a93dabd4 against base b7b230d3d893d8e5062bf0975d61287f33a5aac6, covering the 0bee2ef runtime fix and the c703f3f reconcile, from an isolated export. Not a rerun of the earlier full battery.

Commands run (this head)

  • cargo test -p qbit-prism-server --lib -- api::metrics_snapshot — 6 passed; --lib -- metrics:: — 17 passed; --test observability — 12 passed.
  • PRISM_TEST_REQUIRE_INTEGRATION=1 cargo test -p qbit-prism-server --test observability_database -- --ignored on a disposable PostgreSQL 16 — 2 passed, executed, including live_pool_waits_survive_blocked_publication_through_http (36.7 s).
  • scripts/test_prism_alert_promql.py with promtool 3.14.0 — 28 expressions; 73 scenarios; 145 expression assertions; 86 alert assertions passed; the built-in negative control confirms the original guards fail the 2 required positive scenarios.
  • Both generators --check clean; the CI tarball pin f665c6da…78d for prometheus-3.14.0.linux-amd64 was re-downloaded and matches.

Verified

  • One coherent registry clone feeds every live family per scrape; the concurrent stale-scrape test holds success/failure counts within the producer's single-step ordering.
  • Live-line filtering removes HELP/TYPE and _bucket/_count/_sum samples for live families only and re-renders them once; unit and HTTP tests pin exactly one metadata line and one sample per name.
  • FirstOffer/LockWait stay lazy with no invented samples; PoolAcquire is zero-registered so it never flips between missing and present.
  • Cached-body freshness is never renewed: stored body and published_at are untouched, stale/unavailable headers, health_state 0, metrics_snapshot_stale 1 and collector -1/0 values remain distinct from real zeros.
  • Collector cancel/deadline handling is unchanged in this delta; each 3 s deadline and each cancelled ledger acquisition records one failure with its elapsed wait over real HTTP.
  • The revised expression keeps thresholds, window, ten-sample floor, dwell and labels, and replaces the snapshot gates with up == 1; scenarios cover stale/unpublished/missing bodies, failed/missing scrapes, peer isolation, intermittent stale bodies, and dwell restart. Docs and the rule description now match the live read and state the rollout order.

Findings: no defects. Optional: Family::is_collection now has one caller and the _bucket/_count/_sum suffix list in is_live_line duplicates the renderer's layout (a shared constant keeps them in lockstep); the CI step installs PyYAML although no script imports it. Landing caveat, already documented: deploy the live-overlay producer to every coordinator target before activating the up-gated expression. The prior wording finding from af0dea1 is resolved here.

@djh58

djh58 commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

Correction to the thermo delta checkpoint for c703f3fd4daf8a0c95dd462d8a791861a93dabd4: PyYAML is imported by scripts/test_prism_alert_deployment.py and scripts/test_prism_postgres_alerts.py; it is only unused by scripts/test_prism_alert_promql.py, the one script the new CI step runs. The optional note stands as "unused by that step", not "unused by any script". No other change to the findings.

@djh58

djh58 commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

Adversarial fix-verification checkpoint for head c703f3fd4daf8a0c95dd462d8a791861a93dabd4 (merge-base b7b230d on 3.x.x, i.e. after #334 and #343 landed). Frozen worktree; independent runs only; the earlier full battery was not restarted. Scope: the runtime change 0bee2ef and the integration merge c703f3f.

Correction to my previous checkpoint. I wrote that the pool histogram was "a live registry histogram recorded at scrape time". That was wrong for the code as it stood: /metrics served the cached published body and overlaid only the collector gauges live, so the pool histogram in a stale body was frozen at publication time. The finding itself (the freshness gate re-suppressing the alarm while the publisher waits on the same pool) stands, and this head fixes the cause rather than only the gate.

What the fix does (verified in source). Family::is_live now includes PoolAcquire; overlay_live_observations strips the cached histogram lines (HELP/TYPE, _bucket, _count, _sum) and re-renders them from one current_registry() clone taken under a single lock, appended after the cached body and before the freshness lines, so bucket/count/sum are coherent and the cached-body timestamp/age/x-prism-metrics-state are never renewed. The rule drops the collector-availability and snapshot-freshness terms and requires up == 1 plus the existing ≥10-attempts-in-5m sample guard; no_data_state/exec_err_state stay OK.

Attacked and held.

  • DB-bound publisher + HTTP path: the new gated test holds all four pool connections, runs the real payout_revision → publish → heartbeat → prune sequence, and asserts across nine >30 s iterations that every scrape adds the cancelled ledger and collector acquisitions (count = baseline + 2·n, +Inf bucket equals count, sum grows ≥ 3.75 s per iteration) while collector_available{database} = 0, block_candidates_pending = -1, the body ages past 15 s to stale and health_state = 0; after release a real zero-row collection reports 0, collector_available = 1, stale = 0. Executed here against a throwaway local postgres:16-alpine with PRISM_TEST_REQUIRE_INTEGRATION=1: passes (35 s). The three new metrics_snapshot unit tests pass (6/6 in that module).
  • Coherence: unit test scrapes repeatedly while two producers race; counts are integers, monotonic, ≤ 4096 and the success/failure pair never diverges by more than one observation (one registry clone per scrape).
  • Freshness not renewed: stale scrapes keep x-prism-metrics-state: stale, the age header equals the publication age and published_at is unchanged; unpublished snapshots expose live pool samples without inventing lazy histogram samples for other families.
  • Unknown/stale/failure vs zero: collector gauges keep -1/0 during exhaustion; body gauges keep their freshness gates; zero observations produce no percentile; frozen counts age out (promtool scenarios).
  • Cancellation/deadline identity: cancelled ledger acquisitions and the collector's three-second deadline each record one failure observation with elapsed wait (from 3.x.x: Record advisory-lock and pool-acquire wait metrics in the ledger #328/v3.0.0 fix: record cancelled collector pool acquisitions #345), unchanged by this head.
  • Scrape guard: up == 0 or a missing up series suppresses the rule; a healthy peer cannot authorize a failed or missing instance; other job/network cannot supply counts or scrape availability.
  • Artifacts: the deployment patch regenerated from the pinned frozen template is byte-identical; both generator --check runs and the render/apply test (10 gate combinations, 62 rules, 34 external identical) pass; the digest and expression are the only patch changes besides the description.

Negative controls. promtool 3.14.0 (independent copy): 28 expressions, 73 scenarios, 145 expression assertions and 86 alert assertions pass, and the built-in negative control confirms the original expression fails the two required positive scenarios ("slow waits survive unavailable collector", "publisher freshness cannot reset live pool dwell"). Rust: with the 0bee2ef runtime hunk reverted (tests kept) in a separate worktree and its own cargo target directory, stale_snapshot_overlays_new_pool_waits_without_republishing_other_observations and concurrent_pool_observations_remain_coherent_across_repeated_stale_scrapes fail and the gated regression fails with "live HTTP count must include each ledger and collector cancellation: 0", so the new tests discriminate the fix (the unpublished_snapshot unit test passes on old code because the startup fallback already renders the registry). Note: a first attempt that shared the cargo target directory between the two worktrees silently reused the head binary and reported passes; that run was invalid and is not counted.

Findings. No refutation found at this head. Two non-blocking notes: (1) rollout dependency is real and correctly documented — older producers still cache the histogram, so the revised expression must not be activated before every coordinator target runs this producer; (2) the advisory-lock histogram remains cached (not is_live); it has no rule today, so no impact, but it will need the same treatment before a lock-wait rule is written.

Commands run on the frozen tree: generate_prism_alerts.py --check, generate_prism_metrics.py --check, generate_prism_alerts.py --snapshot <pinned a007a142 templates> --check, test_prism_alert_deployment.py --snapshot …, test_prism_alert_promql.py --promtool promtool-3.14.0, cargo test --lib -- metrics_snapshot::tests, cargo test --test observability_database -- --ignored live_pool_waits_survive_blocked_publication_through_http with PRISM_TEST_REQUIRE_INTEGRATION=1 against a throwaway local postgres:16-alpine, plus the same two cargo runs on a copy with the 0bee2ef runtime hunk reverted. No merge action is being taken from this review.

@djh58

djh58 commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

Coordinator close-out for c703f3f: the final Fable verification confirms the original suppression finding is fixed, with independently executed positive and negative controls; thermo reports no defects, and CI is green on this head. No further code change is required for the reviewed scope. Optional predicate/suffix deduplication and the extra package in the new CI step are deferred as nonblocking maintenance; no behavior depends on changing them. The still-cached advisory-lock histogram has no alert in this scope and must be revisited before a rule is added. The documented deployment prerequisite remains mandatory: deploy the live pool-histogram producer to every coordinator target before enabling the revised expression. Ready for squash merge into 3.x.x; no merge or deployment performed here.

@djh58
djh58 merged commit 923f927 into 3.x.x Sep 14, 2026
31 checks passed
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.

2 participants