Merge "Hook up VisualEditorFeatureUse logging"

This commit is contained in:
jenkins-bot 2020-06-08 22:12:13 +00:00 committed by Gerrit Code Review
commit 0179e00197
2 changed files with 41 additions and 0 deletions

View file

@ -130,4 +130,10 @@ ReplyWidgetVisual.prototype.setPending = function ( pending ) {
}
};
ve.trackSubscribe( 'activity.', function ( topic, data ) {
mw.track( 'dt.schemaVisualEditorFeatureUse', ve.extendObject( data, {
feature: topic.split( '.' )[ 1 ]
} ) );
} );
module.exports = ReplyWidgetVisual;

View file

@ -53,6 +53,17 @@ mw.loader.using( 'ext.eventLogging' ).done( function () {
session_token: user.sessionId(),
version: 1
}
),
schemaVisualEditorFeatureUse = new Schema(
'VisualEditorFeatureUse',
sampleRate,
// defaults:
{
user_id: user.getId(),
user_editcount: mw.config.get( 'wgUserEditCount', 0 ),
platform: 'desktop',
integration: 'discussiontools'
}
);
/* eslint-enable camelcase */
@ -188,4 +199,28 @@ mw.loader.using( 'ext.eventLogging' ).done( function () {
);
}
} );
mw.trackSubscribe( 'dt.schemaVisualEditorFeatureUse', function ( topic, data ) {
var event;
// eslint-disable-next-line camelcase
session.editor_interface = data.editor_interface || session.editor_interface;
event = {
feature: data.feature,
action: data.action,
editingSessionId: session.editing_session_id,
// eslint-disable-next-line camelcase
editor_interface: session.editor_interface
};
if ( trackdebug ) {
log( topic, event );
} else {
schemaVisualEditorFeatureUse.log( event, (
mw.config.get( 'wgDTSchemaEditAttemptStepOversample' ) ||
mw.config.get( 'wgWMESchemaEditAttemptStepOversample' )
) ? 1 : sampleRate );
}
} );
} );