Page MenuHomePhabricator

Implement experimental sessionLength instrument for use in Search Recommendations A/B test
Closed, ResolvedPublic2 Estimated Story Points

Description

Background

User story

  • As a web team engineer i want to be able to see the impact on session length for search recommendations

Requirements

  • Implement the sessionLength instrumentation based off the proposal in T378072 and POC patch

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikimediaEvents/+/1087253/

Acceptance criteria

  • Add acceptance criteria

Communication criteria - does this need an announcement or discussion?

  • no

Event Timeline

bwang triaged this task as High priority.Jan 10 2025, 5:08 PM
bwang moved this task from Incoming to Sprint Backlog on the Web-Team board.
Jdlrobson changed the task status from Open to In Progress.Jan 10 2025, 11:30 PM
Jdlrobson set the point value for this task to 2.Jan 14 2025, 5:28 PM
Jdlrobson moved this task from Q3 to Sprint Backlog on the Web-Team board.
bwang removed bwang as the assignee of this task.Jan 14 2025, 6:11 PM

Change #1087253 had a related patch set uploaded (by LorenMora; author: Kimberly Sarabia):

[mediawiki/extensions/WikimediaEvents@master] Introduce sessionLength mixin

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

Browser Test Steps

FYI - eventLogging needs to be active to test the instrument in the browser. mw.eventLog dependency is required to initialize in the browser environment

Step 1 - Enable eventLogging in Your Environment
  • Once EventLogging extension is loaded, cd to /core/e/EventLogging/devserver
  • npm run eventgate-devserver
  • Confirm that mw.eventLog is available globally by running:
console.log(mw.eventLog);
Step 2 - Confirm Functionality

Once mw.eventLog is properly initialized, try running the below script
Example test:

SessionLengthInstrumentMixin.start('testStream', 'testSchema');
setTimeout(() => {
    SessionLengthInstrumentMixin.stop('testStream');
}, 5000);
How It Verifies Functionality

Core Functionality

  1. Session Start: Ensures SessionLengthInstrumentMixin.start() initializes the session and begins tracking.
  2. Session Stop: Confirms SessionLengthInstrumentMixin.stop() removes the session and halts tracking.
  3. Event Logging: Verifies sessionTick events are logged via mw.eventLog or its mock.

Tick Logic

  • Confirms regulator triggers sessionTick at intervals (TICK_MS, 1 min default).
  • Short test (5s) ensures session lifecycle (start → stop) works, even without reaching a tick.

I manually ran the SessionLengthInstrumentMixin and played around with it and confirmed that:

  1. Session would start and stop
  2. Session would tick at the specified interval
  3. Session would become idle at the specified interval
  4. Session would resume at the specified interval
  5. Session would reset at the specified interval

Change #1087253 merged by jenkins-bot:

[mediawiki/extensions/WikimediaEvents@master] Experimental: Introduce sessionLength mixin

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

LMora-WMF subscribed.