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

Merge pull request #23317 from overleaf/bg-improve-real-time-ping-logs

Add connection details to real-time ping logs

GitOrigin-RevId: f993d71deb1a512295af6c7146a19b730742e33f
Brian Gough 1 год назад
Родитель
Сommit
01ed0c10a0
1 измененных файлов с 11 добавлено и 6 удалено
  1. 11 6
      services/real-time/app/js/Router.js

+ 11 - 6
services/real-time/app/js/Router.js

@@ -235,6 +235,14 @@ module.exports = Router = {
         user = { _id: 'anonymous-user', anonymousAccessToken }
       }
 
+      const connectionDetails = {
+        userId: user._id,
+        projectId,
+        remoteIp: client.remoteIp,
+        publicId: client.publicId,
+        clientId: client.id,
+      }
+
       let pingTimestamp
       let pingId = -1
       let pongId = -1
@@ -243,8 +251,7 @@ module.exports = Router = {
             if (pongId !== pingId) {
               logger.warn(
                 {
-                  publicId: client.publicId,
-                  clientId: client.id,
+                  ...connectionDetails,
                   pingId,
                   pongId,
                   lastPingTimestamp: pingTimestamp,
@@ -262,8 +269,7 @@ module.exports = Router = {
         if (receivedPingId !== pingId) {
           logger.warn(
             {
-              publicId: client.publicId,
-              clientId: client.id,
+              ...connectionDetails,
               receivedPingId,
               pingId,
               sentTimestamp,
@@ -279,8 +285,7 @@ module.exports = Router = {
         ) {
           logger.warn(
             {
-              publicId: client.publicId,
-              clientId: client.id,
+              ...connectionDetails,
               receivedPingId,
               pingId,
               sentTimestamp,