mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 08:23:52 +00:00
Merge "Add override config for instrumentation rates"
This commit is contained in:
commit
3886ae6398
|
@ -203,6 +203,7 @@
|
|||
},
|
||||
"Hooks": {
|
||||
"BeforePageDisplay": "DiscussionToolsHooks::onBeforePageDisplay",
|
||||
"ResourceLoaderGetConfigVars": "DiscussionToolsHooks::onResourceLoaderGetConfigVars",
|
||||
"GetBetaFeaturePreferences": "DiscussionToolsHooks::onGetBetaPreferences",
|
||||
"ListDefinedTags": "DiscussionToolsHooks::onListDefinedTags",
|
||||
"ChangeTagsListActive": "DiscussionToolsHooks::onListDefinedTags",
|
||||
|
@ -220,6 +221,14 @@
|
|||
"DiscussionToolsUseVisualEditor": {
|
||||
"value": false,
|
||||
"description": "Use VisualEditor for editing replies (both visual and wikitext)."
|
||||
},
|
||||
"DTSchemaEditAttemptStepSamplingRate": {
|
||||
"value": false,
|
||||
"description": "Rate at which to sample sessions for instrumentation; overrides WikimediaEvents rate if set"
|
||||
},
|
||||
"DTSchemaEditAttemptStepOversample": {
|
||||
"value": false,
|
||||
"description": "Oversample EditAttemptStep logging; distinct from rate tuning, as it'll flag the events as being oversampled"
|
||||
}
|
||||
},
|
||||
"ConfigRegistry": {
|
||||
|
|
|
@ -80,6 +80,23 @@ class DiscussionToolsHooks {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set static (not request-specific) JS configuration variables
|
||||
*
|
||||
* @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderGetConfigVars
|
||||
* @param array &$vars Array of variables to be added into the output of the startup module
|
||||
* @param string $skinName Current skin name to restrict config variables to a certain skin
|
||||
*/
|
||||
public static function onResourceLoaderGetConfigVars( &$vars, $skinName ) {
|
||||
$dtConfig = MediaWikiServices::getInstance()->getConfigFactory()
|
||||
->makeConfig( 'discussiontools' );
|
||||
|
||||
$vars['wgDTSchemaEditAttemptStepSamplingRate'] =
|
||||
$dtConfig->get( 'DTSchemaEditAttemptStepSamplingRate' );
|
||||
$vars['wgDTSchemaEditAttemptStepOversample'] =
|
||||
$dtConfig->get( 'DTSchemaEditAttemptStepOversample' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for the GetBetaPreferences hook, to add and hide user beta preferences as configured
|
||||
*
|
||||
|
|
|
@ -18,7 +18,8 @@ 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( 'wgWMESchemaEditAttemptStepSamplingRate' ),
|
||||
sampleRate = mw.config.get( 'wgDTSchemaEditAttemptStepSamplingRate' ) ||
|
||||
mw.config.get( 'wgWMESchemaEditAttemptStepSamplingRate' ),
|
||||
actionPrefixMap = {
|
||||
firstChange: 'first_change',
|
||||
saveIntent: 'save_intent',
|
||||
|
@ -180,7 +181,10 @@ mw.loader.using( 'ext.eventLogging' ).done( function () {
|
|||
} else {
|
||||
schemaEditAttemptStep.log(
|
||||
data,
|
||||
mw.config.get( 'wgWMESchemaEditAttemptStepOversample' ) ? 1 : sampleRate
|
||||
(
|
||||
mw.config.get( 'wgDTSchemaEditAttemptStepOversample' ) ||
|
||||
mw.config.get( 'wgWMESchemaEditAttemptStepOversample' )
|
||||
) ? 1 : sampleRate
|
||||
);
|
||||
}
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue