Skip to content

Record proxy request metrics - #270

Merged
andrew merged 1 commit into
mainfrom
request-metrics
Aug 16, 2026
Merged

Record proxy request metrics#270
andrew merged 1 commit into
mainfrom
request-metrics

Conversation

@andrew

@andrew andrew commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Connects the existing proxy_requests_total and proxy_request_duration_seconds metrics to the request middleware.

Package routes receive canonical labels, including rubygems, golang, packagist, and oci. Non-package routes use other, while /metrics is 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_total and proxy_request_duration_seconds in LoggerMiddleware, excluding /metrics.
  • Add path-to-ecosystem canonicalization (rubygems, golang, packagist, oci, else other) for metric labels.
  • Add unit tests covering metric recording, /metrics exclusion, 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.

Base automatically changed from access-log to main August 16, 2026 17:07
@andrew
andrew merged commit 49a68f1 into main Aug 16, 2026
8 checks passed
@andrew
andrew deleted the request-metrics branch August 16, 2026 17:12
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