Page MenuHomePhabricator

MetricsPlatform: Initialize MetricsClient with instrument configs fetched from xLab
Closed, ResolvedPublic2 Estimated Story Points

Description

Parent task/goal: T398480: [Epic] Update instruments configuration for xLab

AC

  • The MetricsClient instance โ€“ initialized in modules/ext.xLab/index.js โ€“ is initialized with instrument configs fetched from xLab
  • MetricsClient#newInstrument() is added to the mw.xLab namespace as mw.xLab.getInstrument(), i.e.
ext.xLab/index.js
mw.xLab = {
  getInstrument: metricsClient.newInstrument.bind( metricsClient )
};

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptAug 7 2025, 10:46 AM
Sfaci triaged this task as High priority.Aug 13 2025, 1:43 PM

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

[mediawiki/extensions/MetricsPlatform@master] ext.xLab: Add mw.xLab.getInstrument()

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

I struggled with making this all work and have thought a lot about how all of these pieces fit together.

The sticking point was trying to get mw.eventLog.submit() and mw.eventLog.newInstrument() to work with the instrument config returned by xLab whilst not further complecting the EventLogging and MetricsPlatform extensions. Simply put, this is impossible. At least, the not further complecting the two extensions bit is impossible.

If we drop the constraint the mw.eventLog.submit() and mw.eventLog.newInstrument() should work with the instrument config returned by xLab, then this becomes quite routine. We:

  1. Fetch instrument configs from xLab
  2. Massage instrument configs into EventStreamConfig-like configs
  3. Initialise a new MetricsClient with the result of (2)
  4. Expose MetricsClient#newInstrument() as mw.xLab.getInstrument()
  5. Profit

With this approach, there is a clear line between older-style (but not legacy) instruments using the mw.eventLog.* methods and instruments powered by Experiment Platform using the mw.xLab.* methods. There will be no confusion about where the config is coming from โ€“ย indeed, we can safely remove the GetStreamConfigs hook without deprecation. Finally, since the two are decoupled, changes to one won't affect the other, which allows the Experiment Platform team to iterate on the Experimentation Lab without impacting ongoing data collection activities.

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

[mediawiki/extensions/EventLogging@master] lib: Update metrics-platform to f1a185532d15

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

Change #1189818 merged by jenkins-bot:

[mediawiki/extensions/EventLogging@master] lib: Update metrics-platform to fc7678c10a1f

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

Change #1183672 merged by jenkins-bot:

[mediawiki/extensions/MetricsPlatform@master] ext.xLab: Add mw.xLab.getInstrument()

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

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

[mediawiki/extensions/MetricsPlatform@wmf/1.45.0-wmf.19] ext.xLab: Add mw.xLab.getInstrument()

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

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

[mediawiki/extensions/MetricsPlatform@wmf/1.45.0-wmf.20] ext.xLab: Add mw.xLab.getInstrument()

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

Change #1190679 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Phuedx):

[mediawiki/extensions/EventLogging@wmf/1.45.0-wmf.19] lib: Update metrics-platform to fc7678c10a1f

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

Change #1190679 merged by jenkins-bot:

[mediawiki/extensions/EventLogging@wmf/1.45.0-wmf.19] lib: Update metrics-platform to fc7678c10a1f

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

Change #1190647 merged by jenkins-bot:

[mediawiki/extensions/MetricsPlatform@wmf/1.45.0-wmf.19] ext.xLab: Add mw.xLab.getInstrument()

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

Mentioned in SAL (#wikimedia-operations) [2025-09-23T14:03:20Z] <lucaswerkmeister-wmde@deploy1003> Started scap sync-world: Backport for [[gerrit:1190667|lib: Update lib/metrics-platform to f1a18553 (T385180)]], [[gerrit:1190679|lib: Update metrics-platform to fc7678c10a1f (T401380)]], [[gerrit:1190647|ext.xLab: Add mw.xLab.getInstrument() (T401380 T404851)]]

Mentioned in SAL (#wikimedia-operations) [2025-09-23T14:09:06Z] <lucaswerkmeister-wmde@deploy1003> phuedx, lucaswerkmeister-wmde: Backport for [[gerrit:1190667|lib: Update lib/metrics-platform to f1a18553 (T385180)]], [[gerrit:1190679|lib: Update metrics-platform to fc7678c10a1f (T401380)]], [[gerrit:1190647|ext.xLab: Add mw.xLab.getInstrument() (T401380 T404851)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-09-23T14:22:14Z] <lucaswerkmeister-wmde@deploy1003> Finished scap sync-world: Backport for [[gerrit:1190667|lib: Update lib/metrics-platform to f1a18553 (T385180)]], [[gerrit:1190679|lib: Update metrics-platform to fc7678c10a1f (T401380)]], [[gerrit:1190647|ext.xLab: Add mw.xLab.getInstrument() (T401380 T404851)]] (duration: 18m 54s)

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

[mediawiki/extensions/EventLogging@wmf/1.45.0-wmf.20] lib: Update metrics-platform to fc7678c10a1f

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

Change #1191683 merged by jenkins-bot:

[mediawiki/extensions/EventLogging@wmf/1.45.0-wmf.20] lib: Update metrics-platform to fc7678c10a1f

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

Change #1190648 merged by jenkins-bot:

[mediawiki/extensions/MetricsPlatform@wmf/1.45.0-wmf.20] ext.xLab: Add mw.xLab.getInstrument()

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

Mentioned in SAL (#wikimedia-operations) [2025-09-26T13:06:39Z] <phuedx@deploy2002> Started scap sync-world: Backport for [[gerrit:1190648|ext.xLab: Add mw.xLab.getInstrument() (T401380 T404851)]], [[gerrit:1191683|lib: Update metrics-platform to fc7678c10a1f (T401380)]]

Mentioned in SAL (#wikimedia-operations) [2025-09-26T13:12:57Z] <phuedx@deploy2002> phuedx: Backport for [[gerrit:1190648|ext.xLab: Add mw.xLab.getInstrument() (T401380 T404851)]], [[gerrit:1191683|lib: Update metrics-platform to fc7678c10a1f (T401380)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-09-26T13:30:34Z] <phuedx@deploy2002> Finished scap sync-world: Backport for [[gerrit:1190648|ext.xLab: Add mw.xLab.getInstrument() (T401380 T404851)]], [[gerrit:1191683|lib: Update metrics-platform to fc7678c10a1f (T401380)]] (duration: 23m 55s)