From 1bb6fb83cf2609e253ac08161b67a7fea3835496 Mon Sep 17 00:00:00 2001 From: Mark Hammond Date: Thu, 18 Jun 2020 08:29:09 +0000 Subject: [PATCH] Bug 1644598 - record/extend telemetry about the push state of FxA devices. r=rfkelly Differential Revision: https://phabricator.services.mozilla.com/D79784 --- services/fxaccounts/FxAccountsCommands.js | 13 ++++++++ services/fxaccounts/FxAccountsDevice.jsm | 8 +++++ toolkit/components/telemetry/Scalars.yaml | 39 ++++++++++++++++++++--- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/services/fxaccounts/FxAccountsCommands.js b/services/fxaccounts/FxAccountsCommands.js index 30a35e811563..5b93becd50c4 100644 --- a/services/fxaccounts/FxAccountsCommands.js +++ b/services/fxaccounts/FxAccountsCommands.js @@ -54,6 +54,19 @@ class FxAccountsCommands { const { sessionToken } = await this._fxai.getUserAccountData([ "sessionToken", ]); + let pushState; + if (!device.pushCallback) { + pushState = "noCallback"; + } else if (device.pushEndpointExpired) { + pushState = "expiredCallback"; + } else { + pushState = "ok"; + } + Services.telemetry.keyedScalarAdd( + "identity.fxaccounts.push_state_command_target", + pushState, + 1 + ); const client = this._fxai.fxAccountsClient; const now = Date.now(); if (now < this._invokeRateLimitExpiry) { diff --git a/services/fxaccounts/FxAccountsDevice.jsm b/services/fxaccounts/FxAccountsDevice.jsm index 9378ab32caf9..63a1a758d24f 100644 --- a/services/fxaccounts/FxAccountsDevice.jsm +++ b/services/fxaccounts/FxAccountsDevice.jsm @@ -231,6 +231,14 @@ class FxAccountsDevice { ourDevice && (ourDevice.pushCallback === null || ourDevice.pushEndpointExpired) ) { + let pushState = ourDevice.pushEndpointExpired + ? "expiredCallback" + : "noCallback"; + Services.telemetry.keyedScalarAdd( + "identity.fxaccounts.push_state_this_device", + pushState, + 1 + ); await this._fxai.fxaPushService.unsubscribe(); await this._registerOrUpdateDevice(currentState, accountData); } diff --git a/toolkit/components/telemetry/Scalars.yaml b/toolkit/components/telemetry/Scalars.yaml index e52941850262..0f4c4985b22c 100644 --- a/toolkit/components/telemetry/Scalars.yaml +++ b/toolkit/components/telemetry/Scalars.yaml @@ -1000,18 +1000,49 @@ extensions.updates: identity.fxaccounts: missed_commands_fetched: bug_numbers: - - 1496638 + - 1644598 description: > The number of missed FxA commands we have recovered. - expires: "68" + expires: "85" kind: uint keyed: false notification_emails: - - fxa-staff@mozilla.com + - sync-team@mozilla.com + release_channel_collection: opt-out + products: + - 'firefox' + record_in_processes: + - main + push_state_command_target: + bug_numbers: + - 1644598 + description: > + The push state of the device we are sending a command to. + expires: "85" + kind: uint + keyed: true + keys: ["ok", "expiredCallback", "noCallback"] + notification_emails: + - sync-team@mozilla.com + release_channel_collection: opt-out + products: + - 'firefox' + record_in_processes: + - main + push_state_this_device: + bug_numbers: + - 1644598 + description: > + The reason why the push state for this device is in a bad shape. + expires: "85" + kind: uint + keyed: true + keys: ["expiredCallback", "noCallback"] + notification_emails: + - sync-team@mozilla.com release_channel_collection: opt-out products: - 'firefox' - - 'fennec' record_in_processes: - main