Skip to content

starknet_transaction_prover: Prometheus /metrics endpoint with build_info#14167

Open
avi-starkware wants to merge 1 commit into
avi/prover-v3/panic-shutdownfrom
avi/prover-v3/metrics
Open

starknet_transaction_prover: Prometheus /metrics endpoint with build_info#14167
avi-starkware wants to merge 1 commit into
avi/prover-v3/panic-shutdownfrom
avi/prover-v3/metrics

Conversation

@avi-starkware
Copy link
Copy Markdown
Collaborator

Adds MetricsLayer that short-circuits GET /metrics with a Prometheus
text-format scrape, and an install_exporter helper that registers the
global recorder and emits prover_build_info with version + git_sha
labels. Wired alongside HealthLayer so the scrape path bypasses the
JSON-RPC parser.

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 HTTP middleware and counters; no changes to proving logic, auth, or transaction handling beyond incrementing a metric on existing capacity rejections.

Overview
Adds Prometheus observability to the Starknet transaction prover: a GET /metrics scrape path and startup metrics registration, wired like the existing health endpoint.

MetricsLayer short-circuits GET /metrics in the HTTP/TLS tower stack (next to HealthLayer, inside request logging) so scrapes never hit the JSON-RPC parser. install_exporter installs the global Prometheus recorder at startup (before bind) and sets prover_build_info (version + git_sha labels) plus pre-registers prover_concurrency_rejected_total.

When prove_transaction rejects a request because the concurrency semaphore is full, the implementation now increments prover_concurrency_rejected_total. Dependencies metrics and metrics-exporter-prometheus are added; a unit test checks the scrape body includes build info.

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

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

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 9c4a5a0. Configure here.


fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
self.inner.poll_ready(cx)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

poll_ready delegates to inner but call may skip it

Medium Severity

MetricsService::poll_ready delegates to self.inner.poll_ready(cx), but call short-circuits for GET /metrics without ever invoking self.inner.call(). This consumes the inner service's readiness without a matching call, which can leak permits or slots in any inner service with stateful backpressure (e.g., Buffer, ConcurrencyLimit). The existing HealthService already handles this correctly by returning Poll::Ready(Ok(())) directly and not delegating to the inner service.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9c4a5a0. Configure here.

…info

Adds `MetricsLayer` that short-circuits `GET /metrics` with a Prometheus
text-format scrape, and an `install_exporter` helper that registers the
global recorder and emits `prover_build_info` with version + git_sha
labels. Wired alongside `HealthLayer` so the scrape path bypasses the
JSON-RPC parser.

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