logger: Use wgWMESchemaVisualEditorFeatureUseSamplingRate config variable

... for the sampling rate for the VisualEditorFeatureUse schema.

Bug: T312016
Depends-On: I259757db0c4441a3fcfce505d5bc82dcf2acf58c
Change-Id: I1c7f9c06384549deac2787f5df93c0078b6402af
This commit is contained in:
Sam Smith 2022-07-29 11:22:56 +01:00
parent e57016414e
commit b90a2675b0

View file

@ -30,8 +30,9 @@ mw.loader.using( 'ext.eventLogging' ).done( function () {
var // Schema class is provided by ext.eventLogging
Schema = mw.eventLog.Schema,
user = mw.user,
sampleRate = mw.config.get( 'wgDTSchemaEditAttemptStepSamplingRate' ) ||
easSampleRate = mw.config.get( 'wgDTSchemaEditAttemptStepSamplingRate' ) ||
mw.config.get( 'wgWMESchemaEditAttemptStepSamplingRate' ),
vefuSampleRate = mw.config.get( 'wgWMESchemaVisualEditorFeatureUseSamplingRate' ) || easSampleRate,
actionPrefixMap = {
firstChange: 'first_change',
saveIntent: 'save_intent',
@ -48,7 +49,7 @@ mw.loader.using( 'ext.eventLogging' ).done( function () {
/* eslint-disable camelcase */
schemaEditAttemptStep = new Schema(
'EditAttemptStep',
sampleRate,
easSampleRate,
// defaults:
{
page_id: mw.config.get( 'wgArticleId' ),
@ -69,7 +70,7 @@ mw.loader.using( 'ext.eventLogging' ).done( function () {
),
schemaVisualEditorFeatureUse = new Schema(
'VisualEditorFeatureUse',
sampleRate,
vefuSampleRate,
// defaults:
{
user_id: user.getId(),
@ -174,7 +175,7 @@ mw.loader.using( 'ext.eventLogging' ).done( function () {
delete data.message;
// eslint-disable-next-line camelcase
data.is_oversample =
!mw.eventLog.inSample( 1 / sampleRate );
!mw.eventLog.inSample( 1 / easSampleRate );
if ( data.action === 'abort' && data.abort_type !== 'switchnochange' ) {
timing = {};
@ -220,7 +221,7 @@ mw.loader.using( 'ext.eventLogging' ).done( function () {
(
mw.config.get( 'wgDTSchemaEditAttemptStepOversample' ) ||
mw.config.get( 'wgWMESchemaEditAttemptStepOversample' )
) ? 1 : sampleRate
) ? 1 : easSampleRate
);
// T309013: Also log via the Metrics Platform:
@ -264,7 +265,7 @@ mw.loader.using( 'ext.eventLogging' ).done( function () {
schemaVisualEditorFeatureUse.log( event, (
mw.config.get( 'wgDTSchemaEditAttemptStepOversample' ) ||
mw.config.get( 'wgWMESchemaEditAttemptStepOversample' )
) ? 1 : sampleRate );
) ? 1 : vefuSampleRate );
}
if ( data.feature === 'editor-switch' && data.action.indexOf( 'dialog-' ) === -1 ) {