Skip to content

Commit 350850a

Browse files
committed
fix(express): get route
1 parent c2ad0af commit 350850a

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

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

0 commit comments

Comments
 (0)