File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -95,22 +95,25 @@ const sdk = new NodeSDK({
95
95
const ignoreRoutes = [ '/metrics' , '/status' , '/health' , '/healthcheck' ]
96
96
return ignoreRoutes . some ( ( url ) => req . url ?. includes ( url ) ) ?? false
97
97
} ,
98
- applyCustomAttributesOnSpan : ( span , req ) => {
98
+ startIncomingSpanHook : ( req ) => {
99
99
let tenantId = ''
100
100
if ( isMultitenant ) {
101
101
if ( requestXForwardedHostRegExp ) {
102
- const serverRequest = req as IncomingMessage
102
+ const serverRequest = req
103
103
const xForwardedHost = serverRequest . headers [ 'x-forwarded-host' ]
104
- if ( typeof xForwardedHost !== 'string' ) return
104
+ if ( typeof xForwardedHost !== 'string' ) return { }
105
105
const result = xForwardedHost . match ( requestXForwardedHostRegExp )
106
- if ( ! result ) return
106
+ if ( ! result ) return { }
107
107
tenantId = result [ 1 ]
108
108
}
109
109
} else {
110
110
tenantId = defaultTenantId
111
111
}
112
- span . setAttribute ( 'tenant.ref' , tenantId )
113
- span . setAttribute ( 'region' , region )
112
+
113
+ return {
114
+ 'tenant.ref' : tenantId ,
115
+ region,
116
+ }
114
117
} ,
115
118
headersToSpanAttributes : {
116
119
client : {
You can’t perform that action at this time.
0 commit comments