Skip to content

Draft: [JS] Extract EventSubmitter interface

Phuedx requested to merge work/phuedx/event_submitter into main

The Integration interface is bloated – an implementation will have many different responsibilities. One of those responsibilities is submitting events to the event ingestion service via Integration#enqueueEvent() . Extract this responsibility into the EventSubmitter interface.

Changes

  1. Extract the EventSubmitter interface
  2. Extract the DefaultEventSubmitter class from the DefaultIntegration class
  3. Create the BrowserEventSubmitter class, which batches events and submits them every 5 seconds, or when the page is backgrounded or unloaded
    1. BrowserEventSubmitter duplicates the logic from mw.eventLogging/BackgroundQueue.js. This is deliberate. It removes our dependency on EventLogging to submit events to the event ingestion service

TODO

  1. Consider merging BrowserEventSubmitter and DefaultEventSubmitter
  2. Documentation
Edited by Phuedx

Merge request reports