mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1928124 - Implement push error metrics a=RyanVM
Original Revision: https://phabricator.services.mozilla.com/D227384 Differential Revision: https://phabricator.services.mozilla.com/D227783
This commit is contained in:
parent
b595303920
commit
efe647a432
@ -41,6 +41,14 @@ const kDELIVERY_REASON_TO_CODE = {
|
||||
[Ci.nsIPushErrorReporter.DELIVERY_INTERNAL_ERROR]: 303,
|
||||
};
|
||||
|
||||
const kERROR_CODE_TO_GLEAN_LABEL = {
|
||||
[Ci.nsIPushErrorReporter.ACK_DECRYPTION_ERROR]: "decryption_error",
|
||||
[Ci.nsIPushErrorReporter.ACK_NOT_DELIVERED]: "not_delivered",
|
||||
[Ci.nsIPushErrorReporter.DELIVERY_UNCAUGHT_EXCEPTION]: "uncaught_exception",
|
||||
[Ci.nsIPushErrorReporter.DELIVERY_UNHANDLED_REJECTION]: "unhandled_rejection",
|
||||
[Ci.nsIPushErrorReporter.DELIVERY_INTERNAL_ERROR]: "internal_error",
|
||||
};
|
||||
|
||||
const prefs = Services.prefs.getBranch("dom.push.");
|
||||
|
||||
ChromeUtils.defineLazyGetter(lazy, "console", () => {
|
||||
@ -720,6 +728,7 @@ export var PushServiceWebSocket = {
|
||||
"handleDataUpdate: Ignoring duplicate message",
|
||||
update.version
|
||||
);
|
||||
Glean.webPush.detectedDuplicatedMessageIds.add();
|
||||
return null;
|
||||
}
|
||||
record.noteRecentMessageID(update.version);
|
||||
@ -846,6 +855,7 @@ export var PushServiceWebSocket = {
|
||||
if (!code) {
|
||||
throw new Error("Invalid delivery error reason");
|
||||
}
|
||||
Glean.webPush.errorCode[kERROR_CODE_TO_GLEAN_LABEL[reason]].add();
|
||||
let data = { messageType: "nack", version: messageID, code };
|
||||
this._queueRequest(data);
|
||||
},
|
||||
@ -856,6 +866,9 @@ export var PushServiceWebSocket = {
|
||||
if (!code) {
|
||||
throw new Error("Invalid ack status");
|
||||
}
|
||||
if (code > 100) {
|
||||
Glean.webPush.errorCode[kERROR_CODE_TO_GLEAN_LABEL[status]].add();
|
||||
}
|
||||
let data = { messageType: "ack", updates: [{ channelID, version, code }] };
|
||||
this._queueRequest(data);
|
||||
},
|
||||
|
42
dom/push/metrics.yaml
Normal file
42
dom/push/metrics.yaml
Normal file
@ -0,0 +1,42 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# Adding a new metric? We have docs for that!
|
||||
# https://firefox-source-docs.mozilla.org/toolkit/components/glean/user/new_definitions_file.html
|
||||
|
||||
---
|
||||
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
|
||||
$tags:
|
||||
- 'Core :: DOM: Push Subscriptions'
|
||||
|
||||
web_push:
|
||||
detected_duplicated_message_ids:
|
||||
type: counter
|
||||
description: >
|
||||
Counts the duplicated IDs from the server. The ability to detect
|
||||
depends on the pref `dom.push.maxRecentMessageIDsPerSubscription`.
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1928124
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1928124
|
||||
notification_emails:
|
||||
- krosylight@mozilla.com
|
||||
expires: never
|
||||
error_code:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
The code indicating why the push message couldn't be processed.
|
||||
labels:
|
||||
- decryption_error
|
||||
- not_delivered
|
||||
- uncaught_exception
|
||||
- unhandled_rejection
|
||||
- internal_error
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1928124
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1928124
|
||||
notification_emails:
|
||||
- krosylight@mozilla.com
|
||||
expires: never
|
@ -27,6 +27,7 @@ gecko_metrics = [
|
||||
"dom/metrics.yaml",
|
||||
"dom/notification/metrics.yaml",
|
||||
"dom/performance/metrics.yaml",
|
||||
"dom/push/metrics.yaml",
|
||||
"dom/quota/metrics.yaml",
|
||||
"dom/security/metrics.yaml",
|
||||
"dom/webauthn/metrics.yaml",
|
||||
|
@ -75,6 +75,8 @@ $schema: moz://mozilla.org/schemas/glean/tags/1-0-0
|
||||
description: The Bugzilla component which applies to this object.
|
||||
'Core :: DOM: Performance':
|
||||
description: The Bugzilla component which applies to this object.
|
||||
'Core :: DOM: Push Subscriptions':
|
||||
description: The Bugzilla component which applies to this object.
|
||||
'Core :: DOM: Security':
|
||||
description: The Bugzilla component which applies to this object.
|
||||
'Core :: DOM: Selection':
|
||||
|
Loading…
Reference in New Issue
Block a user