Page MenuHomePhabricator

Make XLAB_STREAMS allowlist configurable
Closed, ResolvedPublic5 Estimated Story Points

Description

Background

The MediaWiki\Extension\MetricsPlatform\XLab\ResourceLoader\Hooks::XLAB_STREAMS allowlist allows us to have fine-grained control over which stream configurations are sent to the browser to initialise the xLab JS SDK. This is because the number of streams far outweighs the number of streams used for experiments.

However, to date, two teams have needed to use a new stream for their experiment and in both cases, developers have been confused as to why their experiments aren't sending events (and maybe even why setting $wgEventLoggingStreamNames to falsy makes it work).

AC

  • The XLAB_STREAMS allowlist becomes a config variable, e.g. $wgMetricsPlatformExperimentStreamNames
  • The allowlist is initialized to its current value in operations/mediawiki-config
  • The behaviour of the allowlist is made to be independent of $wgEventLoggingStreamNames
  • Experiment#setStream() logs a warning if the stream name isn't in the allowlist

Event Timeline

phuedx updated the task description. (Show Details)
phuedx updated the task description. (Show Details)
Milimetric moved this task from Incoming to READY TO GROOM on the Test Kitchen board.
Milimetric set the point value for this task to 5.Oct 7 2025, 4:00 PM
Milimetric moved this task from READY TO GROOM to Backlog on the Test Kitchen board.

Change #1195830 had a related patch set uploaded (by Phuedx; author: Phuedx):

[operations/mediawiki-config@master] ext-EventLogging: Allowlist product_metrics.web_base_with_ip stream

https://gerrit.wikimedia.org/r/1195830

Change #1195830 merged by jenkins-bot:

[operations/mediawiki-config@master] ext-EventLogging: Allowlist product_metrics.web_base_with_ip stream

https://gerrit.wikimedia.org/r/1195830

Mentioned in SAL (#wikimedia-operations) [2025-10-14T08:03:32Z] <dcausse@deploy2002> Started scap sync-world: Backport for [[gerrit:1193093|cirrus: test completion with default sort on simplewiki [3/3] (T404858)]], [[gerrit:1195830|ext-EventLogging: Allowlist product_metrics.web_base_with_ip stream (T406332)]]

Mentioned in SAL (#wikimedia-operations) [2025-10-14T08:07:50Z] <dcausse@deploy2002> dcausse, phuedx: Backport for [[gerrit:1193093|cirrus: test completion with default sort on simplewiki [3/3] (T404858)]], [[gerrit:1195830|ext-EventLogging: Allowlist product_metrics.web_base_with_ip stream (T406332)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-10-14T08:14:18Z] <dcausse@deploy2002> Finished scap sync-world: Backport for [[gerrit:1193093|cirrus: test completion with default sort on simplewiki [3/3] (T404858)]], [[gerrit:1195830|ext-EventLogging: Allowlist product_metrics.web_base_with_ip stream (T406332)]] (duration: 10m 46s)

Change #1196014 had a related patch set uploaded (by Phuedx; author: Phuedx):

[mediawiki/extensions/MetricsPlatform@master] XLAB_STREAMS -> $wgMetricsPlatformExperimentStreamNames

https://gerrit.wikimedia.org/r/1196014

Re T406332#11270465 onwards:

I tagged that patch with this task because it provides additional context for the

  • The behaviour of the allowlist is made to be independent of $wgEventLoggingStreamNames

AC. Here's what I said to @Milimetric earlier when we discovered that the simple-bot-detection doesn't appear to be sending events:

tl;dr: xLab (the MetricsPlatform extension part) doesn't know that the product_metrics.web_base_with_ip stream exists.

xLab has three distinct instances of the Metrics Platform JS Client ("clients") running on the page: one for logged-in experiments, one for logged-out experiments, and one for instruments. The experiment-related clients have the same stream configs but have different event intake services. The instrument-related client has different stream configs and the same event intake service as the logged-in experiment-related client. This wiring is convoluted but this allows us to keep the client code straightforward as the expense of shipping two distinct sets of stream configs to the browser.

Aside: It occurs to me that we could reduce the number of stream configs sent to the browser to a single set and re-use the logged-in-experiment-related client for instruments too

I implemented the instrument-related stream configs generation using the EventLogging.StreamConfigs service. Now, EventLogging.StreamConfigs returns the set of stream configs that should be sent to the browser for all [pre- and post-xLab] instruments. This is a subset of all stream configs and is controlled by $wgEventLoggingStreamNames.

The issue is that EventLogging.StreamConfigs doesn't contain the stream config for product_metrics.web_base_with_ip. The issue is caused by that stream name not being in $wgEventLoggingStreamNames. This patch fixes that.

Change #1196857 had a related patch set uploaded (by Phuedx; author: Phuedx):

[operations/mediawiki-config@master] MetricsPlatform: Initialize $wgMetricsPlatformExperimentStreamNames

https://gerrit.wikimedia.org/r/1196857

Change #1196857 merged by jenkins-bot:

[operations/mediawiki-config@master] MetricsPlatform: Initialize $wgMetricsPlatformExperimentStreamNames

https://gerrit.wikimedia.org/r/1196857

Mentioned in SAL (#wikimedia-operations) [2025-10-20T13:46:46Z] <lucaswerkmeister-wmde@deploy2002> Started scap sync-world: Backport for [[gerrit:1196492|Enable REST Sandbox on all wikis (T389409)]], [[gerrit:1192913|Growth: remove no longer in use GENewcomerTasksStarterDifficultyEnabled (T396382)]], [[gerrit:1196857|MetricsPlatform: Initialize $wgMetricsPlatformExperimentStreamNames (T406332)]], [[gerrit:1196703|Enable Special:EditWatchlist pagination on beta (T41510)]]

Mentioned in SAL (#wikimedia-operations) [2025-10-20T13:51:18Z] <lucaswerkmeister-wmde@deploy2002> sgimeno, bpirkle, phuedx, lucaswerkmeister-wmde, cparle: Backport for [[gerrit:1196492|Enable REST Sandbox on all wikis (T389409)]], [[gerrit:1192913|Growth: remove no longer in use GENewcomerTasksStarterDifficultyEnabled (T396382)]], [[gerrit:1196857|MetricsPlatform: Initialize $wgMetricsPlatformExperimentStreamNames (T406332)]], [[gerrit:1196703|Enable Special:EditWatchlist paginati

Mentioned in SAL (#wikimedia-operations) [2025-10-20T14:02:31Z] <lucaswerkmeister-wmde@deploy2002> Finished scap sync-world: Backport for [[gerrit:1196492|Enable REST Sandbox on all wikis (T389409)]], [[gerrit:1192913|Growth: remove no longer in use GENewcomerTasksStarterDifficultyEnabled (T396382)]], [[gerrit:1196857|MetricsPlatform: Initialize $wgMetricsPlatformExperimentStreamNames (T406332)]], [[gerrit:1196703|Enable Special:EditWatchlist pagination on beta (T41510)]] (duration

Change #1196014 merged by jenkins-bot:

[mediawiki/extensions/MetricsPlatform@master] XLAB_STREAMS -> $wgMetricsPlatformExperimentStreamNames

https://gerrit.wikimedia.org/r/1196014