Label request metrics with standard HTTP methods only (closes #274)
check / check (push) Waiting to run

The metrics middleware labelled each request with its method as sent,
and Go's HTTP server accepts any method name that is a valid token, so
each made-up method a client sent added series that were never removed.
The method label is now the request's method only for the nine standard
methods, and "other" for any other. The middleware hands the metrics
library a copy of the request carrying the label and serves the next
handler the original, so handlers still see the method the client sent.

Model: opus-5-5
This commit was merged in pull request #277.
This commit is contained in:
2026-10-15 21:47:11 +02:00
parent 742db9ceb1
commit 16f9d1dfd1
4 changed files with 96 additions and 3 deletions
+3 -1
View File
@@ -685,7 +685,9 @@ See `configs/config.example.yml` for all options with defaults.
`metrics.username` and `metrics.password` are set. A request's `handler` label
is the pattern of the route it matches, such as `/v1/image/*`, never its path.
Requests that match no route share the label `unmatched`: those the router
answers 404 or 405, and CORS preflights
answers 404 or 405, and CORS preflights. A request's `method` label is its
method when that is `GET`, `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE`,
`OPTIONS`, `CONNECT` or `TRACE`, and `other` for any other method
- **Logging**: stdlib slog
## Entrypoints