Label request metrics by route, not by path (closes #254)
check / check (push) Waiting to run
check / check (push) Waiting to run
The metrics middleware gave the handler label each request's path, so every new path added series that were never removed, and /metrics listed encrypted URL tokens. The label is now the pattern of the chi route the request matches, or "unmatched" for one that matches none. The metrics library takes the label before calling the handler, so the middleware asks the router with chi's Find which route matches. Model: opus-5-5
This commit is contained in:
@@ -631,7 +631,10 @@ See `configs/config.example.yml` for all options with defaults.
|
||||
- **Metrics**: Prometheus, at `/metrics`: generic HTTP request metrics
|
||||
(duration, response size, requests in flight) and the Go runtime and process
|
||||
metrics; requests are measured and `/metrics` is served only when
|
||||
`metrics.username` and `metrics.password` are set
|
||||
`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
|
||||
- **Logging**: stdlib slog
|
||||
|
||||
## Entrypoints
|
||||
|
||||
Reference in New Issue
Block a user