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

Overview
Adds HttpMetricsLayer to the HTTP and HTTPS middleware stacks below HealthLayer / MetricsLayer so health and /metrics scrapes are not counted in request latency or traffic metrics.

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 exporter install (without seeding the histogram with a zero observation).

Tests use a new test_recorder::shared_handle() (OnceLock) so the global Prometheus recorder is installed once across the crate’s unit tests.

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

Copy link
Copy Markdown
Collaborator Author

avi-starkware commented May 24, 2026

@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
… 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/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
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