(core) change ActiveDoc load and Sandbox call log messages to be aggregation-friendly

Summary:
Takes some numbers embedded in strings and moves them to the context, so
they can be aggregated and trends inspected more easily.

Test Plan: tested manually by looking at logs

Reviewers: dsagal

Reviewed By: dsagal

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D4175
This commit is contained in:
Paul Fitzpatrick 2024-01-24 12:20:47 -05:00
parent ae6a46dd59
commit 457b9714d1
2 changed files with 10 additions and 2 deletions

View File

@ -2380,7 +2380,11 @@ export class ActiveDoc extends EventEmitter {
// took longer, scale it up proportionately.
const closeTimeout = Math.max(loadMs, 1000) * Deps.ACTIVEDOC_TIMEOUT;
this._inactivityTimer.setDelay(closeTimeout);
this._log.debug(docSession, `loaded in ${loadMs} ms, InactivityTimer set to ${closeTimeout} ms`);
log.rawDebug('ActiveDoc load timing', {
...this.getLogMeta(docSession),
loadMs,
closeTimeout,
});
const docUsage = getDocSessionUsage(docSession);
if (!docUsage) {
// This looks be the first time this installation of Grist is touching

View File

@ -312,7 +312,11 @@ export class NSandbox implements ISandbox {
throw new sandboxUtil.SandboxError(e.message);
} finally {
if (this._logTimes) {
log.rawDebug(`Sandbox pyCall[${funcName}] took ${Date.now() - startTime} ms`, this._logMeta);
log.rawDebug('NSandbox pyCall', {
...this._logMeta,
funcName,
loadMs: Date.now() - startTime,
});
}
}
}