Add Prometheus metrics endpoint for Fly.io Grafana#55
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
0855c18 to
d21bd5c
Compare
xumaple
commented
Apr 11, 2026
xumaple
commented
Apr 11, 2026
2d07546 to
8c11aea
Compare
Adds per-endpoint request count and latency metrics via the metrics and metrics-exporter-prometheus crates. GET /metrics serves Prometheus exposition format. fly.toml configured to point Fly.io scraper at it. Closes #14. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Swap custom middleware for the axum-prometheus crate which provides the same per-endpoint counters and histograms out of the box. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove build_router_with_burst_no_metrics. Cache the prometheus layer/handle pair in a OnceLock so build_router_with_burst is safe to call multiple times and always returns the full prod middleware stack. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rename to build_router(RouterConfig) — takes a config struct instead of a bare u32. Remove the convenience wrapper. Improve doc comments to focus on what the function does rather than implementation details. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8c11aea to
762a20f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
metricsandmetrics-exporter-prometheuscrates for per-endpoint Prometheus metricshttp_requests_total(counter) andhttp_request_duration_seconds(histogram), labeled by method, path template, and status codeGET /metricsendpoint serves Prometheus exposition formatfly.tomlconfigured with[metrics]section so Fly.io scrapes automaticallybuild_router_with_burstaccepts aPrometheusHandleparam for testabilityCloses #14
Test plan
test_metrics_endpoint)🤖 Generated with Claude Code