diff --git a/packages/otel/src/index.ts b/packages/otel/src/index.ts index 55bfe7a8..03252913 100644 --- a/packages/otel/src/index.ts +++ b/packages/otel/src/index.ts @@ -30,9 +30,9 @@ export const otel = (async (c, next) => { - const route = c.req.matchedRoutes[c.req.matchedRoutes.length - 1] + const routePath = c.req.routePath await tracer.startActiveSpan( - `${c.req.method} ${route.path}`, + `${c.req.method} ${routePath}`, { kind: SpanKind.SERVER, attributes: { [ATTR_HTTP_REQUEST_METHOD]: c.req.method, [ATTR_URL_FULL]: c.req.url, - [ATTR_HTTP_ROUTE]: route.path, + [ATTR_HTTP_ROUTE]: routePath, }, }, async (span) => {