mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-20 13:54:31 +01:00
metrics: track response method
This commit is contained in:
@@ -16,5 +16,5 @@ export const metricsMiddleware: MiddlewareHandler = async (c, next) => {
|
||||
// Get a parameterized path name like `/posts/:id` instead of `/posts/1234`.
|
||||
// Tries to find actual route names first before falling back on potential middleware handlers like `app.use('*')`.
|
||||
const path = c.req.matchedRoutes.find((r) => r.method !== 'ALL')?.path ?? c.req.routePath;
|
||||
httpResponseCounter.inc({ status, path });
|
||||
httpResponseCounter.inc({ method, status, path });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user