Skip to content

starknet_transaction_prover: bump prover_panics_total on panic hook fire#14170

Open
avi-starkware wants to merge 1 commit into
avi/prover-v3/http-metricsfrom
avi/prover-v3/panic-counter
Open

starknet_transaction_prover: bump prover_panics_total on panic hook fire#14170
avi-starkware wants to merge 1 commit into
avi/prover-v3/http-metricsfrom
avi/prover-v3/panic-counter

Conversation

@avi-starkware
Copy link
Copy Markdown
Collaborator

Bumps the new prover_panics_total counter from the panic hook before
constructing the backtrace, so dashboards can alert on panic rate without
log search. The pre-registered zero observation in install_exporter
keeps the series visible at scrape time even before the first panic.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

@cursor
Copy link
Copy Markdown

cursor Bot commented May 24, 2026

PR Summary

Low Risk
Observability-only change to the panic hook and metrics registration; no change to proving, RPC, or request handling behavior.

Overview
Adds a prover_panics_total Prometheus counter so panic rate can be monitored and alerted on without log search.

The global panic hook now increments that counter first (before backtrace capture and structured tracing output), so a secondary panic during hook work still records the original event. install_exporter pre-registers the series at zero so /metrics exposes it before the first panic. A unit test asserts the hook bumps the counter by one when installed with a shared test recorder.

Reviewed by Cursor Bugbot for commit ac98d86. Bugbot is set up for automated code reviews on this repo. Configure here.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-counter branch from cbd1def to e503ebd Compare May 24, 2026 16:48
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch from 51ebd37 to 6c02d2b Compare May 24, 2026 16:48
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-counter branch from e503ebd to db503b7 Compare May 26, 2026 08:43
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch from 2af08ad to 47068b1 Compare May 26, 2026 12:16
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-counter branch from db503b7 to 1da27e9 Compare May 26, 2026 12:16
Bumps the new `prover_panics_total` counter from the panic hook before
constructing the backtrace, so dashboards can alert on panic rate without
log search. The pre-registered zero observation in `install_exporter`
keeps the series visible at scrape time even before the first panic.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch from 47068b1 to eea5655 Compare May 26, 2026 12:17
@avi-starkware avi-starkware force-pushed the avi/prover-v3/panic-counter branch from 1da27e9 to ac98d86 Compare May 26, 2026 12:17
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ac98d86. Configure here.


let after = counter_value(&handle.render(), PANICS_TOTAL);
assert_eq!(after - before, 1.0);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two tests race on the global panic hook

Medium Severity

The previous code deliberately kept all panic-hook tests in a single #[test] to avoid racing on the process-global panic hook (the old comment explicitly said "must run serially"). Splitting into two separate #[test] functions introduces a race: Rust runs tests in parallel by default, and the take_hook/set_hook save-restore pattern is not atomic. If both tests interleave, one test can steal the other's installed hook, causing extracts_static_str_and_formatted_payloads to fire the real panic_hook instead of its capture closure, or panic_hook_bumps_panics_total_counter to fire a stale hook that doesn't increment the counter. Either test can then fail non-deterministically.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ac98d86. Configure here.

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