Skip to content

starknet_transaction_prover: HTTP request count + latency + in-flight metrics#14169

Open
avi-starkware wants to merge 1 commit into
avi/prover-v3/job-metricsfrom
avi/prover-v3/http-metrics
Open

starknet_transaction_prover: HTTP request count + latency + in-flight metrics#14169
avi-starkware wants to merge 1 commit into
avi/prover-v3/job-metricsfrom
avi/prover-v3/http-metrics

Conversation

@avi-starkware
Copy link
Copy Markdown
Collaborator

Adds HttpMetricsLayer placed between the monitoring endpoints and the
rest of the stack so probes/scrapes don't distort the request-latency
distribution. Records request count by bounded method/status labels,
end-to-end latency, and in-flight gauge. Also adds a shared test recorder
helper that installs the global Prometheus recorder once across the
test binary.

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 tower middleware and test harness changes; no auth, proving, or request-handling logic is modified.

Overview
Adds HttpMetricsLayer to the JSON-RPC HTTP/HTTPS tower stacks (after health and /metrics, before CORS/OHTTP) so health and Prometheus scrapes are not counted in HTTP request latency.

The layer emits prover_http_requests_total (bounded method + status class labels), prover_http_request_duration_seconds, and prover_http_inflight_requests with an RAII guard so in-flight counts drop on panic/cancel. Series are pre-registered at startup via preregister_http_metrics() from install_exporter.

Tests use a new test_recorder::shared_handle() (OnceLock) so the global Prometheus recorder is installed once across the crate; metrics and HTTP metrics tests assert deltas against that shared handle.

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

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

… metrics

Adds `HttpMetricsLayer` placed between the monitoring endpoints and the
rest of the stack so probes/scrapes don't distort the request-latency
distribution. Records request count by bounded method/status labels,
end-to-end latency, and in-flight gauge. Also adds a shared test recorder
helper that installs the global Prometheus recorder once across the
test binary.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avi-starkware avi-starkware force-pushed the avi/prover-v3/job-metrics branch from 7d179cb to a0e7299 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
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