(Go: >> BACK << -|- >> HOME <<)

Page MenuHomePhabricator

Port WebUIScroll schema to the new metrics platform
Closed, ResolvedPublic1 Estimated Story Points

Description

Currently, DesktopUI logs to metric platform via mw.eventLog.dispatch as well as the old one using mw.eventLog.logEvent.

Seems like doing this would:
allow web team to understand how the new event platform works (knowledge share)
give feedback to metrics platform on the experience and issues we encounter
Not impact existing OKRs (since we’re not actively using this schema and presumably we can log to both)

Signoff criteria

  • Create a ticket for @jwang to validate that events are appearing as expected.

Event Timeline

Jdlrobson set the point value for this task to 5.Nov 9 2023, 6:57 PM
Jdlrobson subscribed.

Kim will flesh this ticket out with success criteria and documentation that should come out of this task.

The WebUIScroll instrument should be easy to port as as all of the data that it tracks alongside action can already be filled in by the Metrics Platform client library 🎉 The process should be as simple as:

  1. Update WikimediaEvents/modules/ext.wikimediaEvents/webUIScroll.js as follows:
WikimediaEvents/modules/ext.wikimediaEvents/webUIScroll.js
mw.eventLog.submit( 'mediawiki.web_ui_scroll', data );

// =>

mw.eventLog.submitInteraction(
  'mediawiki.web_ui_scroll.migrated',  // TODO: Bikeshed this!
  '/analytics/product_metrics/web/base/1.0.0',
  action
);
  1. Define the corresponding stream in operations/mediawiki-config/wmf-config/ext-EventStreamConfig.php as follows:
operations/mediawiki-config/wmf-config/ext-EventStreamConfig.php
// See https://phabricator.wikimedia.org/T350883
'mediawiki.web_ui_scroll.migrated' => [
  'schema_title' => 'analytics/product_metrics/web/web_base',
  'destination_event_service' => 'eventgate-analytics-external',
  'producers' => [
    'metrics_platform_client' => [

      // The following is derived from:
      //
      // * https://github.com/wikimedia/mediawiki-extensions-WikimediaEvents/blob/master/modules/ext.wikimediaEvents/webUIScroll.js#L29-L31
      // * https://github.com/wikimedia/mediawiki-extensions-WikimediaEvents/blob/master/modules/ext.wikimediaEvents/webUIScroll.js#L33
      // * https://github.com/wikimedia/mediawiki-extensions-WikimediaEvents/blob/master/modules/ext.wikimediaEvents/webCommon.js#L33-L38
      'provide_values' => [
        'performer_is_bot',
        'mediawiki_database',
        'mediawiki_skin',
        'performer_session_id',
        'page_id',
        'performer_is_logged_in',
      ],
    ],
  ],
  'sample' => [
    'unit' => 'pageview',
    'rate' => 1,
  ],
],
  1. QA the data arriving in the new stream
  2. Transition any existing reports to use the data from the new stream
    • I couldn't find any using Codesearch, on GitHub or GitLab…

Change 977783 had a related patch set uploaded (by Kimberly Sarabia; author: Kimberly Sarabia):

[mediawiki/extensions/WikimediaEvents@master] Port to metrics platform

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

Change 977785 had a related patch set uploaded (by Kimberly Sarabia; author: Kimberly Sarabia):

[operations/mediawiki-config@master] Define the corresponding stream for scroll

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

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

[schemas/event/secondary@master] product_metrics: Add performer.is_bot property to common fragment

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

@KSarabia-WMF and I met last night to discuss the migration. We had the migration working and tested end-to-end by the end of the meeting but we found a bug in the /fragment/analytics/product_metrics/common/1.0.0 schema but otherwise had the migration working. Additionally, I made the following observations based on @KSarabia-WMF's questions during the meeting:

  1. Make it clear that the migrated instrument must submit interaction events to a new stream as the new data contract is incompatible with the existing one
  2. Following on from the above, make it clear that the name of the new stream is to be chosen by the team that owns the instrument (but should follow any guidelines set by the Event Platform, e.g. https://wikitech.wikimedia.org/wiki/Event_Platform/Stream_Configuration#Declaring_streams)
  3. We (Data Products) also need to set guidelines and provide examples for how to provide contextual data. For example, the /analytics/mediawiki/web_ui_scroll has the optional direction (string) and speed (integer) properties. Note well that these properties aren't set by the instrument currently but they could be so it's worthwhile thinking about. I proposed that:
    1. The action_subtype property should supersede the direction property, i.e. action=scroll,direction=up -> action=scroll,action_subtype=up|scroll.up|scroll_up
    2. The action_context property could supersede the scroll_speed property but at the cost of eliding type information/requiring it to be cast to an integer during analysis

As I said in T350883#9330002, all that's required to submit interaction events for this instrument is something like:

mw.eventLog.submitInteraction( STREAM_NAME, '/analytics/product_metrics/web/base/1.1.0', action );

To submit an interaction event like in 3A above, we'd need something like:

mw.eventLog.submitInteraction( STREAM_NAME, '/analytics/product_metrics/web/base/1.1.0', action, {
  action_subtype: getScrollDirection(),
  action_context: String( getScrollSpeed() );
} );

Change 978487 merged by jenkins-bot:

[schemas/event/secondary@master] product_metrics: Add performer.is_bot property to common fragment

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

just to clarify - we want to port WebUIScroll instrument to use MP in parallel with how it is currently submitting events? i.e. add vs replace?

presumably so data scientist can do parity checks between the current method and via MP?

ovasileva added a subscriber: jwang.
ovasileva subscribed.

just to clarify - we want to port WebUIScroll instrument to use MP in parallel with how it is currently submitting events? i.e. add vs replace?

As discussed, that's correct.

Waiting for confirmation on what happens in the js client if events key is missing.
We plan on merging this along with the *webuiactions patch on Monday.

Jdlrobson set the point value for this task to 1.Dec 4 2023, 6:27 PM

Understanding here is that this is mostly done, we just need to merge the remaining code.

Change 977783 merged by jenkins-bot:

[mediawiki/extensions/WikimediaEvents@master] Port to metrics platform

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

Jdlrobson updated the task description. (Show Details)

Kim has created T352342 as follow up work.

Change 977785 merged by jenkins-bot:

[operations/mediawiki-config@master] Define the corresponding stream for scroll

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

Mentioned in SAL (#wikimedia-operations) [2023-12-05T21:42:12Z] <jforrester@deploy2002> Started scap: Backport for [[gerrit:977785|Define the corresponding stream for scroll (T350883)]], [[gerrit:978947|Add stream config for *webuiactions via Metrics Platform (T351298)]]

Mentioned in SAL (#wikimedia-operations) [2023-12-05T21:43:50Z] <jforrester@deploy2002> ksarabia and jforrester and cjming: Backport for [[gerrit:977785|Define the corresponding stream for scroll (T350883)]], [[gerrit:978947|Add stream config for *webuiactions via Metrics Platform (T351298)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2023-12-05T22:01:14Z] <jforrester@deploy2002> Finished scap: Backport for [[gerrit:977785|Define the corresponding stream for scroll (T350883)]], [[gerrit:978947|Add stream config for *webuiactions via Metrics Platform (T351298)]] (duration: 19m 01s)