Skip to content

Commit 60157a0

Browse files
committed
fix(express): get route
1 parent 30e8fc5 commit 60157a0

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
@@ -186,7 +186,13 @@ export class ExpressInstrumentation extends InstrumentationBase<ExpressInstrumen
186186
] as ExpressLayerType;
187187

188188
const rpcMetadata = getRPCMetadata(context.active());
189-
if (rpcMetadata?.type === RPCType.HTTP) {
189+
if (
190+
rpcMetadata?.type === RPCType.HTTP
191+
&& (
192+
!rpcMetadata.route
193+
|| rpcMetadata?.route?.length < route?.length
194+
)
195+
) {
190196
rpcMetadata.route = route || '/';
191197
}
192198

0 commit comments

Comments
 (0)