Label request metrics with standard HTTP methods only (closes #274)
check / check (push) Canceled after 0s

The method label was each request's method as sent, and Go's HTTP
server accepts any method name, so made-up methods added series to the
registry that were never removed. It is now the method only for GET,
HEAD, POST, PUT, PATCH, DELETE, OPTIONS, CONNECT and TRACE, and "other"
for any other. go-http-metrics reads the method from the request it is
handed, so the middleware hands it a copy carrying the label and serves
the next handler the original request.

Model: opus-5-5
This commit is contained in:
2026-10-15 19:01:46 +00:00
parent afb94a14f0
commit bc6464a3c5
3 changed files with 43 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