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 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', () => {
93
93
const runner = createRunner ( )
94
94
. expect ( {
95
95
transaction : {
96
- // FIXME: This is wrong :(
97
- transaction : 'GET /' ,
96
+ transaction : 'GET /does-not-exist' ,
98
97
contexts : {
99
98
trace : {
100
99
span_id : expect . stringMatching ( / [ a - f 0 - 9 ] { 16 } / ) ,
@@ -103,8 +102,6 @@ describe('express v5 tracing', () => {
103
102
'http.response.status_code' : 404 ,
104
103
url : expect . stringMatching ( / \/ d o e s - n o t - e x i s t $ / ) ,
105
104
'http.method' : 'GET' ,
106
- // FIXME: This is wrong :(
107
- 'http.route' : '/' ,
108
105
'http.url' : expect . stringMatching ( / \/ d o e s - n o t - e x i s t $ / ) ,
109
106
'http.target' : '/does-not-exist' ,
110
107
} ,
Original file line number Diff line number Diff line change @@ -164,16 +164,18 @@ export class ExpressInstrumentationV5 extends InstrumentationBase<ExpressInstrum
164
164
// remove duplicate slashes to normalize route
165
165
. replace ( / \/ { 2 , } / g, '/' ) ;
166
166
167
+ const actualRoute = route . length > 0 ? route : undefined ;
168
+
167
169
const attributes : Attributes = {
168
170
// eslint-disable-next-line deprecation/deprecation
169
- [ SEMATTRS_HTTP_ROUTE ] : route . length > 0 ? route : '/' ,
171
+ [ SEMATTRS_HTTP_ROUTE ] : actualRoute ,
170
172
} ;
171
173
const metadata = getLayerMetadata ( route , layer , layerPath ) ;
172
174
const type = metadata . attributes [ AttributeNames . EXPRESS_TYPE ] as ExpressLayerType ;
173
175
174
176
const rpcMetadata = getRPCMetadata ( context . active ( ) ) ;
175
177
if ( rpcMetadata ?. type === RPCType . HTTP ) {
176
- rpcMetadata . route = route || '/' ;
178
+ rpcMetadata . route = actualRoute ;
177
179
}
178
180
179
181
// verify against the config if the layer should be ignored
You can’t perform that action at this time.
0 commit comments