Page MenuHomePhabricator

Migrate SpecialDiff instrument to use submitClick()
Closed, InvalidPublic

Description

Description

The SpecialDiff instrument was added in T326214: Log additional click events on Special:Diff. It submits events representing clicks to UI elements on the Special:Diff/Special:MobileDiff pages. It uses mw.eventLog.dispatch() (it already uses the Metrics Platform!), which is now deprecated. It should be migrated to use mw.eventLog.submitInteractionEvent() or .submitClick().

User Story/ies

As a developer
I want to understand the process of migrating my instrument to the Metrics Platform
So I can migrate my remaining instruments without intervention

Outcome

  • The new instrument is publishing events to distinct stream in parallel with the original

Required

  • Unit tests
  • Integration tests
  • Testing Instructions
  • Passed QA
  • Documentation

Technical Notes

In terms of the data that is collected, the instrument is trivial. It submits an event name, which encodes the source of the click, along with some contextual data. As with other instruments that use the Metrics Platform, the contextual data is controlled by stream config. The stream associated with the instrument is mediawiki.special_diff_interactions (see: https://gerrit.wikimedia.org/g/operations/mediawiki-config/+/74354a8b6deb116163edc42b326fade78ced094a/wmf-config/ext-EventStreamConfig.php#1057).

As I said, the event name encodes the source of the click so migrating the instrument should be as simple as replacing:

WikimediaEvents/modules/ext.wikimediaEvents.specialPages/specialDiff.js
mw.eventLog.dispatch( `specialDiff.click.${eventName}` );

with:

WikimediaEvents/modules/ext.wikimediaEvents.specialPages/specialDiff.js
mw.eventLog.submitClick(

  // TODO: Bikeshed this! It's very difficult to change the name of the stream so pick a good one!
  'mediawiki.special_diff_interactions.migrated',

  {
    action_source: eventName
  }
);

Creating the new stream should be as simple as:

  1. Duplicating the existing stream config
  2. Updating the name of the new stream config to the stream name you chose above
  3. Replacing its schema_title property with /analytics/product_metrics/web/base
  4. Deleting its producers.metrics_platform_client.events property

💪

Dependencies

N/A

Artifacts & Resources

  1. The instrument is defined in the following files:

Event Timeline

phuedx created this object with edit policy "All Users".
phuedx updated the task description. (Show Details)
phuedx renamed this task from Migrate SpecialDiff instrument to use submitClick to Migrate SpecialDiff instrument to use submitClick().Dec 7 2023, 6:42 PM

@phuedx, I already set up the project, I would like to work on this issue

Hi and thank you for your interest! Please check thoroughly https://www.mediawiki.org/wiki/New_Developers (and all of its communication section!). The page covers how to get started, assigning tasks, task status, how to find a codebase, how to create patches, where to ask general development questions and where to get help with setup problems, and how to ask good questions. Thanks a lot! :)

FYI we might be removing this instrumentation shortly (there is already a patch up to do that on T353366)

SGupta-WMF changed the task status from Open to In Progress.Jan 2 2024, 9:35 AM

Moving this to BLOCKED per T352869#9407967.

Sorry. I should've been clearer. Since there's an ongoing discussion about removing this instrument entirely (see T353366), I'm moving this to BLOCKED until that discussion has settled. If we decide to keep the instrument, then we should continue with this migration ASAP; if we decide to remove the instrument, then we should decline this task.