Conversation
Because: - We want to record when a device/account signs out of the browser, including which account and platform (desktop/iOS/Android). The existing frontend account_pref.device_signout event only covers web-settings disconnects and carries no platform, so browser- and app-initiated sign-outs go unrecorded. This commit: - Adds two server-side Glean events: account.device_disconnected (on /account/device/destroy) and account.session_destroyed (on /session/destroy), each with a platform extra key. - Adds a pure platformFromOS helper in fxa-shared/lib/user-agent that maps a parsed user-agent OS to desktop/ios/android/unknown. - Threads glean into the devices factory and emits at both destroy paths; platform is derived from the disconnected device uaOS and the session user-agent OS respectively. - Regenerates server_events.ts and adds unit tests for the helper and both emission sites.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Because
account_pref.device_signoutevent only fires for web-settings disconnects and carries no platform, so browser- and app-initiated sign-outs go unrecorded.This pull request
fxa-backend-metrics.yaml:account.device_disconnected(on/account/device/destroy) andaccount.session_destroyed(on/session/destroy), each with aplatformextra key.platformFromOShelper infxa-shared/lib/user-agent.tsthat maps a parsed user-agent OS todesktop/ios/android/unknown.Issue that this pull request solves
Closes: https://mozilla-hub.atlassian.net/browse/FXA-13092
Checklist
Other information
deviceType? Two existingdeviceTypesignals were considered and rejected:session_device_type(UA-derived) only yieldsmobile/tablet/'', can't distinguish iOS from Android, and reflects the acting client's UA rather than the disconnected device.typeonly exists for registered Sync/OAuth devices, so it's empty for plain web/settings sessions (/session/destroy) and still doesn't split iOS vs Android.device.uaOS/request.app.ua.os) is present on both paths and cleanly buckets todesktop/ios/android.account_pref.device_signoutand the new server-sideaccount.device_disconnectedfire. The server event is the comprehensive one; flag to the data team to avoid double-counting.metricsContext, sosession_flow_id/utm_*are empty on those events (expected).