diff --git a/plugins/node/opentelemetry-instrumentation-nestjs-core/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-nestjs-core/src/instrumentation.ts index c94c2ec0a3f..9aa1df479ab 100644 --- a/plugins/node/opentelemetry-instrumentation-nestjs-core/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-nestjs-core/src/instrumentation.ts @@ -187,8 +187,8 @@ function createWrapCreateHandler(tracer: api.Tracer, moduleVersion?: string) { [AttributeNames.VERSION]: moduleVersion, [AttributeNames.TYPE]: NestType.REQUEST_CONTEXT, [SemanticAttributes.HTTP_METHOD]: req.method, - [SemanticAttributes.HTTP_URL]: req.originalUrl, - [SemanticAttributes.HTTP_ROUTE]: req.route.path, + [SemanticAttributes.HTTP_URL]: req.originalUrl || req.url, + [SemanticAttributes.HTTP_ROUTE]: req.route?.path || req.routerPath, [AttributeNames.CONTROLLER]: instanceName, [AttributeNames.CALLBACK]: callbackName, },