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({
9595 const ignoreRoutes = [ '/metrics' , '/status' , '/health' , '/healthcheck' ]
9696 return ignoreRoutes . some ( ( url ) => req . url ?. includes ( url ) ) ?? false
9797 } ,
98- applyCustomAttributesOnSpan : ( span , req ) => {
98+ startIncomingSpanHook : ( req ) => {
9999 let tenantId = ''
100100 if ( isMultitenant ) {
101101 if ( requestXForwardedHostRegExp ) {
102- const serverRequest = req as IncomingMessage
102+ const serverRequest = req
103103 const xForwardedHost = serverRequest . headers [ 'x-forwarded-host' ]
104- if ( typeof xForwardedHost !== 'string' ) return
104+ if ( typeof xForwardedHost !== 'string' ) return { }
105105 const result = xForwardedHost . match ( requestXForwardedHostRegExp )
106- if ( ! result ) return
106+ if ( ! result ) return { }
107107 tenantId = result [ 1 ]
108108 }
109109 } else {
110110 tenantId = defaultTenantId
111111 }
112- span . setAttribute ( 'tenant.ref' , tenantId )
113- span . setAttribute ( 'region' , region )
112+
113+ return {
114+ 'tenant.ref' : tenantId ,
115+ region,
116+ }
114117 } ,
115118 headersToSpanAttributes : {
116119 client : {
You can’t perform that action at this time.
0 commit comments