(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
This commit is contained in:
Paul Fitzpatrick 2021-04-23 16:52:31 -04:00
parent ee3a8a2b85
commit 47ea00dea3
2 changed files with 5 additions and 1 deletions

View File

@ -274,6 +274,7 @@ export class GristWSConnection extends Disposable {
this.send(JSON.stringify({
beat: 'alive',
url: G.window.location.href,
docId: this._assignmentId,
}));
}

View File

@ -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));