Page MenuHomePhabricator

SessionTick instrument should use sessionStorage instead of localStorage
Closed, ResolvedPublic3 Estimated Story Points

Description

Background

As part of https://phabricator.wikimedia.org/T387150, @jwang found that there was far too many sessions with tick events compared to sessions with click search events. Tick events are supposed to only start after a user first clicks on the searchbar.

User story

  • As a data analyst, I need session events to only show for users that receive the treatment or control search experience

Requirements

  • Sessions in the Search AB test with session tick events should always be associated with click events too

Acceptance criteria

  • We switch from storing sessionTick and lastSessionTime in localStorage to sessionStorage
  • We remove any existing items from localStorage using a call to mw.storage.remove that is documented. This should be called outside the mediawiki.web_AB_test_enrollment hook to make sure it's removed wherever found.
  • The change to fix this is backported.
  • We update the experiment name to include "v2.0" so we can distinguish cached events from new events in our data validation. This should be done in the config repo and MUST include the string RelatedArticles test in the name. The config change should happen after the change has been backported.

QA

We will perform data QA to confirm (or not confirm) whether the volume is now meeting expectations.
We confirm on super set that our data volume is expected.

-- Count unique sessions that have tick events

SELECT  mediawiki."database", 
count(distinct performer.session_id) AS sessions, count(1) AS events
FROM event.product_metrics_web_base_search_ab_test_session_ticks
WHERE year=2025 and month=3 and day=3
AND NOT performer.is_logged_in 
GROUP BY mediawiki."database", element_at(experiments.assigned, 'RelatedArticles test experiment v2')  , day

-- Count unique sessions that have clicked on the search bar
SELECT mediawiki."database",  element_at(experiments.assigned, 'RelatedArticles test experiment v2') AS assigned_group , day, count(distinct performer.session_id) AS sessions, count(1) AS events
FROM event.product_metrics_web_base_search_ab_test_clicks
WHERE year=2025 and month=3 AND day=3
AND action='click'
AND action_source='search_box'
GROUP BY mediawiki."database", element_at(experiments.assigned, 'RelatedArticles test experiment v2')  , day

Communication criteria - does this need an announcement or discussion?

  • Add communication criteria

Sign off

Event Timeline

bwang triaged this task as High priority.Feb 26 2025, 10:12 PM

@jwang found that there was far too many sessions with tick events compared to sessions with click search events. Tick events are supposed to only start after a user first clicks on the searchbar.

So what do we need to do?
reduce the sampling rate? Or change the behaviour? If the latter, what is the requested behavioural change?

Jdlrobson-WMF changed the task status from Open to In Progress.Feb 27 2025, 5:50 PM
Jdlrobson-WMF moved this task from Incoming to Q3 on the Web-Team board.

Change #1123443 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/extensions/WikimediaEvents@master] Limit session ticks to per sessionId, fix show empty search events firing for control group

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

Change #1123443 abandoned by Bernard Wang:

[mediawiki/extensions/WikimediaEvents@master] POC: Limit session ticks to per sessionId, fix show empty search events firing for control group

Reason:

use session storage

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

Change #1123448 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/extensions/WikimediaEvents@master] Use session storage for session tick events

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

Jdlrobson-WMF renamed this task from Fix too many session tick events in Search AB test to SessionTick instrument should use sessionStorage instead of localStorage.Feb 27 2025, 7:55 PM
Jdlrobson-WMF updated the task description. (Show Details)
Jdlrobson-WMF set the point value for this task to 3.

Change #1123449 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[operations/mediawiki-config@master] Update experiment name for Search AB test french wiki

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

Change #1123448 merged by jenkins-bot:

[mediawiki/extensions/WikimediaEvents@master] Use session storage for session tick events

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

Assuming you are assignee here. Next step is to backport, right?

Change #1123734 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/extensions/WikimediaEvents@wmf/1.44.0-wmf.18] Use session storage for session tick events

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

yep, it’s on the docket for today at 3pm cst

Change #1123734 merged by jenkins-bot:

[mediawiki/extensions/WikimediaEvents@wmf/1.44.0-wmf.18] Use session storage for session tick events

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

Change #1123449 merged by jenkins-bot:

[operations/mediawiki-config@master] Update experiment name for Search AB test french wiki

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

Mentioned in SAL (#wikimedia-operations) [2025-03-03T21:34:55Z] <tgr@deploy2002> Started scap sync-world: Backport for [[gerrit:1123734|Use session storage for session tick events (T387400)]], [[gerrit:1123449|Update experiment name for Search AB test french wiki (T387400)]]

Mentioned in SAL (#wikimedia-operations) [2025-03-03T21:37:34Z] <tgr@deploy2002> bwang, tgr: Backport for [[gerrit:1123734|Use session storage for session tick events (T387400)]], [[gerrit:1123449|Update experiment name for Search AB test french wiki (T387400)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2025-03-03T22:01:00Z] <tgr@deploy2002> Finished scap sync-world: Backport for [[gerrit:1123734|Use session storage for session tick events (T387400)]], [[gerrit:1123449|Update experiment name for Search AB test french wiki (T387400)]] (duration: 26m 04s)

SToyofuku-WMF subscribed.

Steph to verify events in superset, then pass to Edward for QA

Verified events are coming in using select * from event.product_metrics_web_base_search_ab_test_session_ticks where contains(experiments.enrolled, 'RelatedArticles test experiment v2') in superset - over to you

@SToyofuku-WMF I'm not sure if this is a data QA only task. But the title seems to suggest that the session tick should be using session storage instead of local storage. That said, I'm not entirely clear as to what the behavior should be, but I do see some session tick keys in both. See below.

screenshot 60.png (215×1 px, 33 KB)

screenshot 61.png (232×1 px, 73 KB)

Yes that looks like a pass! the wme session tick in local storage is from something else