Hook up VisualEditorFeatureUse logging

Bug: T252924
Depends-On: I77b2dabc39b730bc50c67029e67fedc1f173d248
Change-Id: I0189038d09ffe023b6c06be8250b412dc06d9b81
This commit is contained in:
David Lynch 2020-05-06 17:03:16 -05:00
parent 9f2ead06eb
commit 5ccb0538fd
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; module.exports = ReplyWidgetVisual;

View file

@ -53,6 +53,17 @@ mw.loader.using( 'ext.eventLogging' ).done( function () {
session_token: user.sessionId(), session_token: user.sessionId(),
version: 1 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 */ /* 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 );
}
} );
} ); } );