From 47ea00dea351f314d5c08dbb1eaaa475647edc26 Mon Sep 17 00:00:00 2001 From: Paul Fitzpatrick Date: Fri, 23 Apr 2021 16:52:31 -0400 Subject: [PATCH] (core) add user and docId to heartbeat logging Summary: add user and docId to heartbeat logging Test Plan: checked manually Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2784 --- app/client/components/GristWSConnection.ts | 1 + app/server/lib/Client.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/client/components/GristWSConnection.ts b/app/client/components/GristWSConnection.ts index df443389..05871f59 100644 --- a/app/client/components/GristWSConnection.ts +++ b/app/client/components/GristWSConnection.ts @@ -274,6 +274,7 @@ export class GristWSConnection extends Disposable { this.send(JSON.stringify({ beat: 'alive', url: G.window.location.href, + docId: this._assignmentId, })); } diff --git a/app/server/lib/Client.ts b/app/server/lib/Client.ts index 3d68b51c..125d542e 100644 --- a/app/server/lib/Client.ts +++ b/app/server/lib/Client.ts @@ -247,8 +247,11 @@ export class Client { const clientId = this.clientId; const request = JSON.parse(message); if (request.beat) { + const profile = this.getProfile(); // this is a heart beat, to keep the websocket alive. No need to reply. - log.rawInfo('heartbeat', {clientId, counter: this._counter, url: request.url}); + log.rawInfo('heartbeat', {clientId, counter: this._counter, url: request.url, + docId: request.docId, // caution: trusting client for docId for this purpose. + email: profile?.email, userId: this.getCachedUserId()}); return; } else { log.info("%s: onMessage", this, shortDesc(message));