Просмотр исходного кода

fix(api-gateway): add extra meta to logs

Karol Sójko 1 год назад
Родитель
Сommit
a341e78909

+ 3 - 0
packages/api-gateway/src/Service/Http/HttpServiceProxy.ts

@@ -240,6 +240,9 @@ export class HttpServiceProxy implements ServiceProxyInterface {
         tooManyRetryAttempts
           ? `Request to ${serverUrl}/${endpoint} timed out after ${retryAttempt} retries`
           : `Could not pass the request to ${serverUrl}/${endpoint} on underlying service: ${detailedErrorMessage}`,
+        {
+          userId: response.locals.user ? response.locals.user.uuid : undefined,
+        },
       )
 
       this.logger.debug(`Response error: ${JSON.stringify(error)}`)

+ 3 - 0
packages/api-gateway/src/Service/gRPC/GRPCServiceProxy.ts

@@ -275,6 +275,9 @@ export class GRPCServiceProxy implements ServiceProxyInterface {
         tooManyRetryAttempts
           ? `Request to ${serverUrl}/${endpoint} timed out after ${retryAttempt} retries`
           : `Could not pass the request to ${serverUrl}/${endpoint} on underlying service: ${detailedErrorMessage}`,
+        {
+          userId: response.locals.user ? response.locals.user.uuid : undefined,
+        },
       )
 
       this.logger.debug(`Response error: ${JSON.stringify(error)}`)