Closed Bug 1504687 Opened 6 years ago Closed 6 years ago

Change the glean API to be async

Categories

(Toolkit :: Telemetry, enhancement, P1)

enhancement
Points:
3

Tracking

()

RESOLVED FIXED
Tracking Status
firefox65 --- affected

People

(Reporter: Dexter, Assigned: Dexter)

References

Details

(Whiteboard: [telemetry:mobilesdk:m3])

Attachments

(1 file)

The glean API is currently synchronous and working on the main thread. This is bad, as we might block some important things such as UI refresh. This bug is about changing the glean internals so that everything that requires I/O is async.
Blocks: 1491345
Points: --- → 3
Priority: -- → P3
Whiteboard: [telemetry:mobilesdk:m4]
Whiteboard: [telemetry:mobilesdk:m4] → [telemetry:mobilesdk:m3]
Assignee: nobody → alessio.placitelli
Priority: P3 → P1
I had a nice conversation with Sebastian about this. In addition to moving I/O off the main thread (a few bottlenecks are identified in [1]), we might want to use coroutines to make all the calls to the API internals async and off the main thread. This can be done by: - Implementing our own dispatcher as done here [2] - Creating a coroutine scope that uses the dispatcher [3] - And using `scope.launch {}` in the MetricType(s) so that every call doesn't block the main thread and runs on a separate thread. The risk of running everything on the main thread is that Android might display an alert prompting to kill the app. [1] - https://docs.google.com/document/d/1G2pDJgUNHdgmu_7VBy0qx0yhUVJMPSog2YyWsWK0j48/edit# [2] - https://github.com/mozilla-mobile/android-components/blob/ae0b2d93eefba74329a507e3158c5efeb72e843f/components/browser/awesomebar/src/main/java/mozilla/components/browser/awesomebar/BrowserAwesomeBar.kt#L34 [3] - https://github.com/mozilla-mobile/android-components/blob/ae0b2d93eefba74329a507e3158c5efeb72e843f/components/browser/awesomebar/src/main/java/mozilla/components/browser/awesomebar/BrowserAwesomeBar.kt#L37
Attached file GitHub Pull Request
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: