From ed0222b0d01f07f86d0a710d4d310d3c037bfee5 Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Fri, 23 Oct 2020 11:06:32 -0700 Subject: [PATCH] Remove client side error counting Bug: T266359 Change-Id: I5350c801e7ecb7b8b28e54410cc57fd3b548b2ef --- README.md | 6 --- bundlesize.config.json | 2 +- includes/MinervaHooks.php | 1 - .../skins.minerva.scripts/errorLogging.js | 44 ------------------- resources/skins.minerva.scripts/initMobile.js | 2 - skin.json | 11 ----- 6 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 resources/skins.minerva.scripts/errorLogging.js diff --git a/README.md b/README.md index 609a5c261..54ace00ae 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,6 @@ for the page. Controls whether site notices should be shown. See . -#### $wgMinervaCountErrors -* Type: `Boolean` -* Default: `false` - -Whether to count client side errors in statsv. - #### $wgMinervaShowCategoriesButton * Type: `Array` diff --git a/bundlesize.config.json b/bundlesize.config.json index 848cee19b..2f96bb448 100644 --- a/bundlesize.config.json +++ b/bundlesize.config.json @@ -37,6 +37,6 @@ }, { "resourceModule": "skins.minerva.scripts", - "maxSize": "12.1KB" + "maxSize": "11.8KB" } ] diff --git a/includes/MinervaHooks.php b/includes/MinervaHooks.php index af8a0ed63..88e1eaac3 100644 --- a/includes/MinervaHooks.php +++ b/includes/MinervaHooks.php @@ -330,7 +330,6 @@ class MinervaHooks { $roConf = MediaWikiServices::getInstance()->getConfiguredReadOnlyMode(); $vars += [ 'wgMinervaABSamplingRate' => $config->get( 'MinervaABSamplingRate' ), - 'wgMinervaCountErrors' => $config->get( 'MinervaCountErrors' ), 'wgMinervaReadOnly' => $roConf->isReadOnly(), ]; } diff --git a/resources/skins.minerva.scripts/errorLogging.js b/resources/skins.minerva.scripts/errorLogging.js deleted file mode 100644 index b67915062..000000000 --- a/resources/skins.minerva.scripts/errorLogging.js +++ /dev/null @@ -1,44 +0,0 @@ -( function ( track, config, trackSubscribe, user ) { - module.exports = function () { - var suffix = user.isAnon() ? '.anon' : '.loggedin', - // we will keep track of errors counted, so that we don't overcount problematic - // browsers/users which are generating multiple issues. See MAX_ERRORS. - reportedInThisSession = 0, - // Very conservative for now. - // After this many errors are tracked, no more will be logged. - MAX_ERRORS = 5, - COUNTER_NAME = 'counter.MediaWiki.minerva.WebClientError' + suffix; - - /** - * Count javascript errors, except for those associated with localStorage - * being full or unavailable. - * - * @param {string} topic name of the event being tracked - * @param {Object} data event payload - */ - function countError( topic, data ) { - var isLocalStorage = data && data.source === 'store-localstorage-update'; - // Some errors, for example the Leaflet "Set map center and zoom first" - // error (T257872) can trigger a high volume of client side error reports to the server. - // At time of writing 1 IP logged 245 errors in the same session and page and another - // logged 3,029 errors across 2 pages. To filter these kind of errors out, set a cap - // on the amount of errors that can be logged in a single session. - if ( !isLocalStorage && reportedInThisSession < MAX_ERRORS ) { - track( COUNTER_NAME, 1 ); - } - reportedInThisSession++; - } - - if ( config.get( 'wgMinervaCountErrors' ) ) { - // track RL exceptions - trackSubscribe( 'resourceloader.exception', countError ); - // setup the global error handler - trackSubscribe( 'global.error', countError ); - } - }; -}( - mw.track, - mw.config, - mw.trackSubscribe, - mw.user -) ); diff --git a/resources/skins.minerva.scripts/initMobile.js b/resources/skins.minerva.scripts/initMobile.js index f09209ce8..a45b8b473 100644 --- a/resources/skins.minerva.scripts/initMobile.js +++ b/resources/skins.minerva.scripts/initMobile.js @@ -16,7 +16,6 @@ module.exports = function () { toast = mobile.toast, Icon = mobile.Icon, time = mobile.time, - errorLogging = require( './errorLogging.js' ), preInit = require( './preInit.js' ), mobileRedirect = require( './mobileRedirect.js' ), search = require( './search.js' ), @@ -416,7 +415,6 @@ module.exports = function () { issues.init( overlayManager, currentPageHTMLParser ); } - mw.requestIdleCallback( errorLogging ); // deprecation notices mw.log.deprecate( router, 'navigate', router.navigate, 'use navigateTo instead' ); diff --git a/skin.json b/skin.json index 5c5401f06..ca070eb39 100644 --- a/skin.json +++ b/skin.json @@ -25,9 +25,6 @@ "MediaWiki": ">= 1.35.0" }, "config": { - "MinervaCountErrors": { - "value": false - }, "MinervaDonateLink": { "value": { "base": true @@ -247,13 +244,6 @@ ] } }, - "attributes": { - "EventLogging": { - "Schemas": { - "WebClientError": 18340282 - } - } - }, "ResourceModules": { "skins.minerva.base.styles": { "class": "ResourceLoaderSkinModule", @@ -563,7 +553,6 @@ "resources/skins.minerva.scripts/drawers.js", "resources/skins.minerva.scripts/ctaDrawers.js", "resources/skins.minerva.scripts/menu.js", - "resources/skins.minerva.scripts/errorLogging.js", "resources/skins.minerva.scripts/preInit.js", "resources/skins.minerva.scripts/downloadPageAction.js", "resources/skins.minerva.scripts/page-issues/parser.js",