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
This commit is contained in:
Alex Monk 2015-03-18 22:15:54 +00:00
parent 70cff83f68
commit 88088d4ecc
2 changed files with 14 additions and 3 deletions

View file

@ -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 );
};
/**

View file

@ -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 = {};