Repository navigation
3.x.x: alert on order and settlement advisory-lock waits (#461 S-C) - #463
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Closed
3 tasks
kiwidream
force-pushed
the
cutover-safety/lock-wait-alerts
branch
from
September 18, 2026 19:18
898a5db to
068ed0d
Compare
Member
Author
|
CI note: the shard-1 failure on |
qbit_prism_database_advisory_lock_wait_seconds has been recorded since #328 with no rule attached, so a coordinator can sit behind the order or settlement advisory lock indefinitely without anyone being paged. Add two native rules. PrismDatabaseAdvisoryLockWaitHigh watches the per-lock p99 over five minutes, and PrismDatabaseAdvisoryLockFailuresCritical pages on the per-lock failure ratio, where failure also covers a wait abandoned by cancellation. Both exclude lock="migration": that lock is taken only at schema initialization, where waiting out an online migration window is expected rather than a fault. The family is rendered from the cached snapshot body rather than read live at scrape time, so both rules carry the snapshot-fresh gate the other cached-body rules use. A stale or unpublished body suppresses them instead of repeating an old percentile, and the failure ratio stays absent rather than zero until a first failure is observed, which is why no-data remains OK. Fixture scenarios cover per-lock discrimination, the per-lock sample minimum, migration-only waits, stale and missing snapshot series, and both sides of the five-percent failure boundary. The inventory prohibition on this family is narrowed to these two rule UIDs so no other rule can reach for it, and the first-offer prohibition is untouched. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The migration narrative still said proof-to-first-offer waits were declared with a rule deferred, and that advisory-lock waits had no rule written. Both are now wrong: the first-offer histogram is instrumented as qbit_prism_block_submit_seconds under #391, and the advisory-lock rules land in this branch. Say what is actually true. First-offer carries no firing rule because it is observed at most once per found block, which is too sparse for a rate or a percentile, not because a rule is pending. Name the two advisory-lock rules and record that lock="migration" is deliberately outside them. The same correction applies to the retired-name reasons, so the generated migration tables and the review-only deployment patch are regenerated. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Every sample-minimum scenario so far carried only result="success" series, so PrismDatabaseAdvisoryLockFailuresCritical's ratio was absent and its >=10 gate was never evaluated. Collapsing that gate to a shared minimum across both locks therefore passed the suite untouched. Add a scenario where a busy clean lock records 100 waits with no failures while the other lock records two waits, one of them a failure. The ratio is 0.5 but the sample is two, so the per-lock gate drops it and the contract value stays zero; a shared minimum would lend the clean lock's hundred waits to the failing one and page. Add a second scenario where both locks breach on their own samples, pinning the value at two for the percentile and the ratio alike so neither rule may silently collapse two locks into one series. Co-Authored-By: Claude Fable 5.1 <[email protected]>
kiwidream
force-pushed
the
cutover-safety/lock-wait-alerts
branch
from
September 22, 2026 19:20
068ed0d to
a6d10b3
Compare
djh58
added a commit
that referenced
this pull request
Sep 22, 2026
Refs #493. Resolves the scenario fixture as a by-name union (the #463 advisory-lock scenarios plus this branch's landing cases) and regenerates the deployment patch. The native paging-rule assertion now also covers the #463 advisory-lock critical, which already satisfies it; the exact set check becomes a subset check so new paging rules are covered rather than listed. Co-Authored-By: Claude Fable 5.1 <[email protected]>
25 of 40 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #461 (S-C). Target
3.x.x, base pin587aef59.What
Two native alert rules for
qbit_prism_database_advisory_lock_wait_seconds(recorded since #328, no rule until now —docs/prism-alert-migration.md:120), indocs/prism-native-alert-rules.json:lock=~"order|settlement"> 1 s, from ≥10 waits for that lock.page: "true"): per-lockresult="failure"share > 5 % over 5 m, from ≥10 waits.Both are gated on the snapshot-fresh gate used by the other cached-body families (
Family::is_liveexcludesLockWait;api/metrics_snapshot/tests.rsshows it is served frozen from the cached body), notup == 1.lock="migration"is excluded and the description says why (taken only at schema initialisation; waiting out an online migration is expected).basiscites #271's 15/31/63 ORDER_LOCK waiters, the 5 sPRISM_DATABASE_LOCK_TIMEOUT_MSdefault, that no native percentile exists, and "provisional, measure in #291/#447".Derived artifacts regenerated (
generate_prism_alerts.py --snapshotagainst qbit-toolsa007a142, sha verified): migration tables,prism-alert-rules-qbit-tools.patch. Hand-written prose corrected: the first-offer histogram exists asqbit_prism_block_submit_seconds(#391) and carries no firing rule because it yields one sample per found block (prism-alert-migration.md,prism-native-metrics.md,prism-alert-migration.jsonretired reasons).tests/observability/inventory.rsrelaxes the "no rule on this family" assertion for the two uids only; the deployment test's rule count goes 62→64.No metric, label or registration changes (
src/metrics*untouched; #278).Tests
14 new scenarios in
tests/fixtures/prism-alert-scenarios.json: fires per lock, fast waits, migration-only waits, stale / unpublished / missing snapshot, both sides of the 5 % boundary, below the per-lock minimum, a failing lock that cannot borrow the other lock's samples, both locks breaching at once (value 2). Mutation checks (applied and restored): selector widened tolock=~".*"→ migration scenario fails; snapshot gate dropped → stale scenarios fail; per-lock count gate collapsed to a shared minimum → borrow scenario fails (both rules); hand edit inside the generated table →generate_prism_alerts.py --checkfails.generate_prism_alerts.py --check --snapshot,test_prism_alert_promql.py(promtool 3.14.0; 30 expressions, 87 scenarios),test_prism_alert_deployment.py,generate_prism_metrics.py --check,cargo test --test observability, fmt, clippy, settings/gate/toolchain checks — all pass.Not covered
Thresholds are provisional until #447/#291. promtool registers native rules as recording rules, so
for/severity are not timing-tested (pre-existing). A hand edit inside the generated migration table is caught bygenerate_prism_alerts.py --check(run by the observability inventory test) but not bytest_prism_alert_deployment.py, becausespecification_digest()does not hash the.md— pre-existing, one-line follow-up.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.