Skip to content

Commit e3cc934

Browse files
committed
fix(metrics): normalize route for smart-wire requests in metrics
1 parent d0ca846 commit e3cc934

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

backend/src/plugins/prometheus.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,16 @@ const prometheusPlugin: FastifyPluginAsync = async (fastify) => {
4444
const diff = process.hrtime(request.startTime);
4545
const duration = diff[0] + diff[1] / 1e9;
4646

47-
const route =
47+
let route =
4848
(request as any).routerPath ??
4949
request.routeOptions?.url ??
5050
request.raw.url?.split("?")[0] ??
5151
"unknown";
5252

53+
if (route.startsWith("/smart-wire/")) {
54+
route = "/smart-wire/:slug";
55+
}
56+
5357
if (route === "/metrics") {
5458
httpRequestsInFlight.dec();
5559
return;

0 commit comments

Comments
 (0)