Skip to content

Commit 089a228

Browse files
committed
fix(express): get route
1 parent 27d6503 commit 089a228

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,13 @@ export class ExpressInstrumentation extends InstrumentationBase {
197197
] as ExpressLayerType;
198198

199199
const rpcMetadata = getRPCMetadata(context.active());
200-
if (rpcMetadata?.type === RPCType.HTTP) {
200+
if (
201+
rpcMetadata?.type === RPCType.HTTP
202+
&& (
203+
!rpcMetadata.route
204+
|| rpcMetadata?.route?.length < route?.length
205+
)
206+
) {
201207
rpcMetadata.route = route || '/';
202208
}
203209

0 commit comments

Comments
 (0)