From 88088d4eccd45bc957f071e89e436c16c6297d7c Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Wed, 18 Mar 2015 22:15:54 +0000 Subject: [PATCH] Set action.saveFailure.message key in Edit schema This relies on WikimediaMessages' version of the Edit schema being updated at the same time. Change-Id: Iee97fdd2a867f2c252ca7756f2e6341377d9fbb7 --- modules/ve-mw/init/ve.init.mw.TargetEvents.js | 15 ++++++++++++--- modules/ve-mw/init/ve.init.mw.trackSubscriber.js | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/ve-mw/init/ve.init.mw.TargetEvents.js b/modules/ve-mw/init/ve.init.mw.TargetEvents.js index 169b0da0eb..1a83572fdc 100644 --- a/modules/ve-mw/init/ve.init.mw.TargetEvents.js +++ b/modules/ve-mw/init/ve.init.mw.TargetEvents.js @@ -110,7 +110,8 @@ ve.init.mw.TargetEvents.prototype.onSaveComplete = function ( content, categorie * @param {string} type Text for error type */ ve.init.mw.TargetEvents.prototype.trackSaveError = function ( type ) { - var key, + var key, data, + failureArguments = [], // Maps mwtiming types to mwedit types typeMap = { badtoken: 'userBadToken', @@ -127,6 +128,10 @@ ve.init.mw.TargetEvents.prototype.trackSaveError = function ( type ) { // (for historical reasons; this sucks) specialTypes = [ 'editconflict' ]; + if ( arguments ) { + failureArguments = Array.prototype.slice.call( arguments, 1 ); + } + key = 'performance.user.saveError'; if ( specialTypes.indexOf( type ) !== -1 ) { key += '.' + type; @@ -137,10 +142,14 @@ ve.init.mw.TargetEvents.prototype.trackSaveError = function ( type ) { type: type } ); - ve.track( 'mwedit.saveFailure', { + data = { type: typeMap[type] || 'responseUnknown', timing: ve.now() - this.timings.saveInitiated + ( this.timings.serializeForCache || 0 ) - } ); + }; + if ( type === 'unknown' && failureArguments[1].error && failureArguments[1].error.code ) { + data.message = failureArguments[1].error.code; + } + ve.track( 'mwedit.saveFailure', data ); }; /** diff --git a/modules/ve-mw/init/ve.init.mw.trackSubscriber.js b/modules/ve-mw/init/ve.init.mw.trackSubscriber.js index 6631c9f1d4..b1c7356662 100644 --- a/modules/ve-mw/init/ve.init.mw.trackSubscriber.js +++ b/modules/ve-mw/init/ve.init.mw.trackSubscriber.js @@ -115,11 +115,13 @@ event['action.' + action + '.type'] = event.type; event['action.' + action + '.mechanism'] = event.mechanism; event['action.' + action + '.timing'] = Math.round( computeDuration( action, event, timeStamp ) ); + event['action.' + action + '.message'] = event.message; // Remove renamed properties delete event.type; delete event.mechanism; delete event.timing; + delete event.message; if ( action === 'abort' ) { timing = {};