From bcf38234f823ee6236dfb45832febb45e1a93c15 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Fri, 9 Aug 2024 15:00:30 +0000 Subject: [PATCH] Bug 1911382 - [remote] Reduce logs for MessageHandler module system r=webdriver-reviewers,whimboo Removing those 2 logs by default reduces the log size of the pup wd job significantly (320K lines -> 200K lines) Differential Revision: https://phabricator.services.mozilla.com/D218777 --- remote/shared/Log.sys.mjs | 11 +++++++++ .../shared/messagehandler/ModuleCache.sys.mjs | 24 ++++++++++++------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/remote/shared/Log.sys.mjs b/remote/shared/Log.sys.mjs index f1b3706391ec..e7e38edef308 100644 --- a/remote/shared/Log.sys.mjs +++ b/remote/shared/Log.sys.mjs @@ -62,6 +62,17 @@ export class Log { return StdLog.Level[lazy.logLevel] <= StdLog.Level.Trace; } + /** + * WARNING: This helper is incorrectly implemented and probably doesn't do + * what you would expect. + * + * At the moment `verbose` will be true for the least verbose log levels: + * INFO, WARN, ERROR and FATAL. Fixing the issue would lead to too much + * additional log spam on CI so we will need to use another approach, and + * probably to decouple it from the log level. + * + * See https://bugzilla.mozilla.org/show_bug.cgi?id=1828395 + */ static get verbose() { // we can't use Preferences.sys.mjs before first paint, // see ../browser/base/content/test/performance/browser_startup.js diff --git a/remote/shared/messagehandler/ModuleCache.sys.mjs b/remote/shared/messagehandler/ModuleCache.sys.mjs index 6cff8dff60f0..7383ecde01db 100644 --- a/remote/shared/messagehandler/ModuleCache.sys.mjs +++ b/remote/shared/messagehandler/ModuleCache.sys.mjs @@ -233,14 +233,22 @@ export class ModuleCache { moduleClass = this.#protocol.modules[moduleFolder][moduleName]; } - if (moduleClass) { - lazy.logger.trace( - `Module ${moduleFolder}/${moduleName}.sys.mjs found for ${destinationType}` - ); - } else { - lazy.logger.trace( - `Module ${moduleFolder}/${moduleName}.sys.mjs not found for ${destinationType}` - ); + // Module hit/miss logs generate a lot of spam. Only log if verbose is true. + // + // Note: Due to https://bugzilla.mozilla.org/show_bug.cgi?id=1828395 + // verbose is currently always false if the log level is trace. + // If those logs are needed before the bug is fixed, temporarily remove the + // condition. + if (lazy.Log.verbose) { + if (moduleClass) { + lazy.logger.trace( + `Module ${moduleFolder}/${moduleName}.sys.mjs found for ${destinationType}` + ); + } else { + lazy.logger.trace( + `Module ${moduleFolder}/${moduleName}.sys.mjs not found for ${destinationType}` + ); + } } return moduleClass;