File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
dev-packages/node-integration-tests/suites/express-v5/tracing
packages/node/src/integrations/tracing/express-v5 Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -93,8 +93,7 @@ describe('express v5 tracing', () => {
9393 const runner = createRunner ( )
9494 . expect ( {
9595 transaction : {
96- // FIXME: This is wrong :(
97- transaction : 'GET /' ,
96+ transaction : 'GET /does-not-exist' ,
9897 contexts : {
9998 trace : {
10099 span_id : expect . stringMatching ( / [ a - f 0 - 9 ] { 16 } / ) ,
@@ -103,8 +102,6 @@ describe('express v5 tracing', () => {
103102 'http.response.status_code' : 404 ,
104103 url : expect . stringMatching ( / \/ d o e s - n o t - e x i s t $ / ) ,
105104 'http.method' : 'GET' ,
106- // FIXME: This is wrong :(
107- 'http.route' : '/' ,
108105 'http.url' : expect . stringMatching ( / \/ d o e s - n o t - e x i s t $ / ) ,
109106 'http.target' : '/does-not-exist' ,
110107 } ,
Original file line number Diff line number Diff line change @@ -164,16 +164,18 @@ export class ExpressInstrumentationV5 extends InstrumentationBase<ExpressInstrum
164164 // remove duplicate slashes to normalize route
165165 . replace ( / \/ { 2 , } / g, '/' ) ;
166166
167+ const actualRoute = route . length > 0 ? route : undefined ;
168+
167169 const attributes : Attributes = {
168170 // eslint-disable-next-line deprecation/deprecation
169- [ SEMATTRS_HTTP_ROUTE ] : route . length > 0 ? route : '/' ,
171+ [ SEMATTRS_HTTP_ROUTE ] : actualRoute ,
170172 } ;
171173 const metadata = getLayerMetadata ( route , layer , layerPath ) ;
172174 const type = metadata . attributes [ AttributeNames . EXPRESS_TYPE ] as ExpressLayerType ;
173175
174176 const rpcMetadata = getRPCMetadata ( context . active ( ) ) ;
175177 if ( rpcMetadata ?. type === RPCType . HTTP ) {
176- rpcMetadata . route = route || '/' ;
178+ rpcMetadata . route = actualRoute ;
177179 }
178180
179181 // verify against the config if the layer should be ignored
You can’t perform that action at this time.
0 commit comments