Record proxy request metrics - #270
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Connects existing Prometheus request metrics to the server’s request logging middleware so request counts and durations are recorded per request with consistent timing across logs, access-log entries, and metrics.
Changes:
- Record
proxy_requests_totalandproxy_request_duration_secondsinLoggerMiddleware, excluding/metrics. - Add path-to-ecosystem canonicalization (
rubygems,golang,packagist,oci, elseother) for metric labels. - Add unit tests covering metric recording,
/metricsexclusion, and ecosystem mapping.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| README.md | Documents the two request metrics and their labels in the Prometheus metrics table. |
| internal/server/middleware.go | Records request count + duration metrics in LoggerMiddleware and adds ecosystem label mapping. |
| internal/server/middleware_test.go | Adds tests validating request metric increments, /metrics exclusion, and ecosystem labeling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
andrew
force-pushed
the
request-metrics
branch
from
August 16, 2026 16:42
968b62f to
053a6b5
Compare
andrew
force-pushed
the
request-metrics
branch
from
August 16, 2026 17:07
053a6b5 to
0866d1a
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.
Connects the existing
proxy_requests_totalandproxy_request_duration_secondsmetrics to the request middleware.Package routes receive canonical labels, including
rubygems,golang,packagist, andoci. Non-package routes useother, while/metricsis excluded so scrapes do not count themselves. The middleware shares one duration measurement with request logs and access-log records.This is stacked on #269 because both changes touch
LoggerMiddleware.