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 logic, or request handling behavior changes beyond metric recording.

Overview
Adds HTTP-level Prometheus observability to the Starknet transaction prover JSON-RPC server via a new HttpMetricsLayer in the shared prover_http_middleware! stack (HTTP and HTTPS).

The layer records request count (prover_http_requests_total with bounded method/status labels), end-to-end latency (prover_http_request_duration_seconds), and an in-flight gauge (prover_http_inflight_requests) with an RAII guard so panics/cancellation do not leak the gauge. It is placed below HealthLayer / MetricsLayer so /health and /metrics traffic that those layers short-circuit is not included in latency or request counts. Metrics are pre-registered at exporter install (without fake histogram samples).

Tests use a new test_recorder OnceLock helper so the global Prometheus recorder is installed once across the test binary, avoiding races when multiple tests need metrics.

Reviewed by Cursor Bugbot for commit 2eaa611. 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/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 2 times, most recently from 6c02d2b to 2af08ad Compare May 26, 2026 08:43
@avi-starkware avi-starkware force-pushed the avi/prover-v3/job-metrics branch 2 times, most recently from 00671e6 to 68683f0 Compare May 26, 2026 12:16
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch 2 times, most recently from 47068b1 to eea5655 Compare May 26, 2026 12:17
@avi-starkware avi-starkware force-pushed the avi/prover-v3/job-metrics branch from 00f7551 to b51be4a Compare May 26, 2026 12:58
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch from eea5655 to df42f2f Compare May 26, 2026 12:58
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch from df42f2f to 83d004c Compare May 26, 2026 16:14
@avi-starkware avi-starkware force-pushed the avi/prover-v3/job-metrics branch from b51be4a to 396774b Compare May 26, 2026 16:14
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch from 83d004c to 9122417 Compare May 26, 2026 16:47
@avi-starkware avi-starkware force-pushed the avi/prover-v3/job-metrics branch 2 times, most recently from 6f17bb1 to fb01d37 Compare May 26, 2026 16:59
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch from 9122417 to 23731d6 Compare May 26, 2026 16:59
@avi-starkware avi-starkware force-pushed the avi/prover-v3/job-metrics branch from fb01d37 to f1b98e4 Compare May 27, 2026 10:01
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch from 23731d6 to 145ff10 Compare May 27, 2026 10:01
@avi-starkware avi-starkware force-pushed the avi/prover-v3/job-metrics branch from f1b98e4 to 9898133 Compare May 27, 2026 10:35
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch 2 times, most recently from 130f7f6 to 7fa5a6d Compare May 27, 2026 12:55
@avi-starkware avi-starkware force-pushed the avi/prover-v3/job-metrics branch from 9898133 to 6974938 Compare May 27, 2026 12:56
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch from 7fa5a6d to fe8282d Compare May 27, 2026 13:11
@avi-starkware avi-starkware force-pushed the avi/prover-v3/job-metrics branch 2 times, most recently from d0b3654 to d84bd92 Compare May 27, 2026 14:04
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch from fe8282d to d9c346a Compare May 27, 2026 14:04
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch from d9c346a to d3505a7 Compare May 27, 2026 14:20
@avi-starkware avi-starkware force-pushed the avi/prover-v3/job-metrics branch 2 times, most recently from b2da23d to ac34a57 Compare May 31, 2026 10:23
@avi-starkware avi-starkware force-pushed the avi/prover-v3/http-metrics branch 2 times, most recently from 1b96cdb to f13a24c Compare June 1, 2026 08:17
… 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>
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