Page MenuHomePhabricator

[EPIC] Incorporate librarized Metrics Platform Java client into the Android app
Closed, ResolvedPublic

Event Timeline

Mholloway created this task.

Here are my notes on the Android (Java) implementation as of rMLMP7ceb5cbb9e75: Simplify event queuing by using a single buffer.:

 Low Complexity

  1. A session is 30 minutes long
  2. Events should have contextual attributes set immediately.
    • Consider the following case: the user navigates to page A; backgrounds the application; foregrounds it some considerable time later; and navigates to page B. If the actions after the navigation to page A all occur before the enqueued event is sent, then the event will be sent with incorrect contextual values (as well as, potentially, a new session ID)
  3. The responsibility of maintaining session state is split between SessionController and MetricsClient
    • I suggest reducing the SessionController API to touch() and getSessionID()
    • SessionController.getSessionID() should transparently refresh the session ID if the session hasn't been "touched" in 30 minutes

 Medium-to-high Complexity

  1. Sessions don't automatically expire
    • The SessionTick instrument detects when a user session has been idle for 30 minutes. Idle here means that the user hasn't clicked, pressed a key, scrolled, or backgrounded/foregrounded
  2. MetricsClient has the responsibility of maintaining and periodically flushing the queue of events. This should be a separate class/collection of classes that MetricsClient collaborates with (see https://gerrit.wikimedia.org/r/c/mediawiki/libs/metrics-platform/+/820530)
  3. MetricsClient has the responsibility of maintaining and periodically updating the stream config collection. This should be a separate class/collection of classes that MetricsClient collaborates with
    • StreamConfigs are fetched every 30 seconds. What about radio/data consumption?
  4. Events should be sent in batches. EventGate is capable of accepting multiple events in one request

 High complexity

  1. MetricsClient has no dispatch() method
    • The implementation should be consistent with the implementations for the JS and PHP clients. There's a test harness that can test that the clients are producing consistent events given the same configuration in the top-level of the repo

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

[mediawiki/libs/metrics-platform@master] SessionController: Reduce API surface area

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

phuedx renamed this task from Incorporate librarized Metrics Platform Java client into the Android app to [EPIC] Incorporate librarized Metrics Platform Java client into the Android app.Sep 29 2022, 4:08 AM
phuedx added a project: Epic.

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

[mediawiki/libs/metrics-platform@master] [Java] SessionController: The session length is 30 minutes

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

Change 836126 merged by jenkins-bot:

[mediawiki/libs/metrics-platform@master] [Java] SessionController: Reduce API surface area

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

Change 836791 merged by jenkins-bot:

[mediawiki/libs/metrics-platform@master] [Java] SessionController: The session length is 30 minutes

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

phuedx subscribed.
phuedx claimed this task.

Being bold.