Skip to content

3.x.x: give /metrics the freshness contract /healthz already has - #299

Merged
djh58 merged 3 commits into
3.x.xfrom
djh58/prism-b5-metrics-freshness
Sep 10, 2026
Merged

djh58 merged 3 commits into
3.x.xfrom
djh58/prism-b5-metrics-freshness

Conversation

@djh58

@djh58 djh58 commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Restore freshness reporting for the native coordinator and public API /metrics routes. The coordinator publishes the complete payload and its monotonic timestamp together, exposes snapshot availability/age/staleness, and reports unhealthy when publication stalls. Both roles restore the freshness and cache headers used by 2.x.x. Operator documentation explains warm-up, stale snapshots, and failed public database probes.

Closes #277. Target: 3.x.x.

Validation:

  • Workspace: cargo +1.89.0 test --locked -j 2 --workspace --all-targets — 403 reported passes; external integration prerequisites were absent in that run.
  • Native server: cargo +1.89.0 test --locked -j 2 -p qbit-prism-server --all-targets -- --test-threads=4 with disposable PostgreSQL 16, a pinned qbit v1.0.0 regtest node, and the physical replication test enabled — 153 passes, 0 failures. This includes 29 ledger tests, 8 live mining tests, and the synchronous primary-loss/reconnect test.
  • A negative control that advertised healthy from a stale coordinator snapshot failed the real-router regression; restored code passed.
  • Astra ultra reviewed the implementation and acceptance coverage. Formatting and diff checks pass.

The replication test kills a disposable local database process; this does not establish multi-host production availability or load capacity.

Documentation: the operator guide covers snapshot gauges, both roles’ freshness headers, and startup/stale behavior. The publisher ticks every 2 seconds. The freshness-budget input defaults to 2 seconds natively and 5 in Compose; both produce a 15-second stale threshold.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

djh58 and others added 2 commits September 10, 2026 16:11
Publish the complete metrics body and monotonic timestamp together. Apply
the health freshness budget at scrape time and restore freshness headers
for both mining and public API roles.

Cover unavailable, fresh, stale and recovered publications, GET/HEAD,
public probe failures, and wall-time independence with ungated tests.

Refs #277
@djh58
djh58 force-pushed the djh58/prism-b5-metrics-freshness branch from 565f64d to bfa7914 Compare September 10, 2026 20:32
@djh58 djh58 changed the title v1.1.1 fix: restore PRISM metrics snapshot freshness 3.x.x: give /metrics the freshness contract /healthz already has Sep 10, 2026
@djh58

djh58 commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

Deep-review dispositions for the two Fable documentation findings:

  • Fixed: the new operator wording implied that PRISM_HEALTH_REFRESH_SECONDS controls publication cadence. Commit 9148a0e now says it controls the freshness budget, while the publisher ticks every two seconds; it also documents integer parsing and fallback. The PR description is corrected too.
  • Rebutted: the HTTP 503 warm-up explanation in docs/prism-overload-alerts.md belongs to the removed Python implementation. The existing opening paragraph explicitly labels the entire remainder historical and directs Rust operators to the current documentation. It is not the native runbook. This PR's native guide explicitly specifies HTTP 200 with X-Prism-Metrics-State: unavailable during warm-up.

The medium Codex, structural Astra and independent Astra adversarial lanes found no actionable issue. Fable found no runtime defect and passed six focused metrics tests. Codex's native review command at medium effort substitutes for the unavailable named built-in skill; Astra is used for its adversarial lane per Dan's model preference. Final CI is rerunning after the documentation correction; this is not a readiness report.

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