File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
plugins/node/opentelemetry-instrumentation-express Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -266,6 +266,16 @@ export function getActualMatchedRoute(req: {
266
266
return constructedRoute ;
267
267
}
268
268
269
+ // For RegExp routes or route arrays, return the constructed route
270
+ // This handles the case where the route is defined using RegExp or an array
271
+ if ( constructedRoute . includes ( '/' ) &&
272
+ ( constructedRoute . includes ( ',' ) ||
273
+ constructedRoute . includes ( '\\' ) ||
274
+ constructedRoute . includes ( '*' ) ||
275
+ constructedRoute . includes ( '[' ) ) ) {
276
+ return constructedRoute ;
277
+ }
278
+
269
279
// Ensure route starts with '/' if it doesn't already
270
280
const normalizedRoute = constructedRoute . startsWith ( '/' )
271
281
? constructedRoute
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ describe('ExpressInstrumentation', () => {
103
103
104
104
for ( const span of spans ) {
105
105
assert . strictEqual (
106
- span . attributes [ SEMATTRS_HTTP_ROUTE ] ,
106
+ span . attributes [ ATTR_HTTP_ROUTE ] ,
107
107
undefined , // none of the spans have the HTTP route attribute
108
108
`Span "${ span . name } " should not have HTTP route attribute for non-existing route`
109
109
) ;
You can’t perform that action at this time.
0 commit comments