Page MenuHomePhabricator

[JS] Test distribution of pageview/session IDs
Closed, ResolvedPublic3 Estimated Story Points

Description

AC

  • Copy the algorithm in mw.user.generateRandomSessionId into the JS client library to generate pageview/session IDs
  • A unit test is added to test the distribution of pageview/session IDs generated by the algorithm (see note 2 below)

See https://gitlab.wikimedia.org/phuedx/id-distribution-test.

Notes

  1. The algorithm would be best placed in DefaultIntegration (or nearby?) so that it's testable in isolation and so that DefaultIntegration#getPageviewID() and #getSessionID() get implementations!
  • We don't actually need to test if ~10% of sessions are determined to be in sample when sample rate is 0.1, etc. – INSTEAD we just need to verify that the distribution of those N numbers (obtained from "normalizing" the randomly generated session IDs) is approximately Uniform(0,1).

Event Timeline

phuedx set the point value for this task to 3.