Glean internal metrics.

Metrics initialized here should be defined in ./metrics.yaml and manually translated into JS code.

Constructors

Properties

appDisplayVersion: InternalStringMetricType

Methods

  • Generates and sets the client_id if it is not set, or if the current value is corrupted.

    Returns void

  • Migrates the core metrics from the old IDB storage to LocalStorage on first launch IF the client had used previous versions of Glean.js - pre LocalStorage.

    There is no way to access IDB data synchronously, so we rely on listeners for when specific actions complete. This means that we need to be careful and ensure that the clientId and firstRunDate are always set.

    Once the migration is complete, running the initialize functions for the clientId and firstRunDate equate to no-ops. If there is an error anywhere along the way and the migration is not complete, then the initialize the two metrics as usual.

    Returns void

  • Update local stored session information for Glean. This is called whenever the app on initialization and just after every read/write/delete to/from storage.

    There are a few scenarios to handle depending on what we already have stored about the session and how long it has been since the last action.

    SCENARIOS:

    1. If this is the first session (there is no existing session ID), then we set a new session ID and a lastActive timestamp.

    2. If the session is not expired, then we only update the lastActive time.

    3. If the session is expired (inactive threshold is more recent than lastActive) then we update the session ID, the session sequence number, and the lastActive time.

    Returns void

Generated using TypeDoc