forked from mirrors/gecko-dev
Bug 1928124 - Implement push error metrics a=dmeehan
Differential Revision: https://phabricator.services.mozilla.com/D227855
This commit is contained in:
parent
0d9d8f3071
commit
aab8368c04
4 changed files with 58 additions and 0 deletions
|
|
@ -41,6 +41,14 @@ const kDELIVERY_REASON_TO_CODE = {
|
||||||
[Ci.nsIPushErrorReporter.DELIVERY_INTERNAL_ERROR]: 303,
|
[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.");
|
const prefs = Services.prefs.getBranch("dom.push.");
|
||||||
|
|
||||||
ChromeUtils.defineLazyGetter(lazy, "console", () => {
|
ChromeUtils.defineLazyGetter(lazy, "console", () => {
|
||||||
|
|
@ -720,6 +728,7 @@ export var PushServiceWebSocket = {
|
||||||
"handleDataUpdate: Ignoring duplicate message",
|
"handleDataUpdate: Ignoring duplicate message",
|
||||||
update.version
|
update.version
|
||||||
);
|
);
|
||||||
|
Glean.webPush.detectedDuplicatedMessageIds.add();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
record.noteRecentMessageID(update.version);
|
record.noteRecentMessageID(update.version);
|
||||||
|
|
@ -846,6 +855,7 @@ export var PushServiceWebSocket = {
|
||||||
if (!code) {
|
if (!code) {
|
||||||
throw new Error("Invalid delivery error reason");
|
throw new Error("Invalid delivery error reason");
|
||||||
}
|
}
|
||||||
|
Glean.webPush.errorCode[kERROR_CODE_TO_GLEAN_LABEL[reason]].add();
|
||||||
let data = { messageType: "nack", version: messageID, code };
|
let data = { messageType: "nack", version: messageID, code };
|
||||||
this._queueRequest(data);
|
this._queueRequest(data);
|
||||||
},
|
},
|
||||||
|
|
@ -856,6 +866,9 @@ export var PushServiceWebSocket = {
|
||||||
if (!code) {
|
if (!code) {
|
||||||
throw new Error("Invalid ack status");
|
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 }] };
|
let data = { messageType: "ack", updates: [{ channelID, version, code }] };
|
||||||
this._queueRequest(data);
|
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
|
||||||
|
|
@ -25,6 +25,7 @@ gecko_metrics = [
|
||||||
"dom/media/webrtc/metrics.yaml",
|
"dom/media/webrtc/metrics.yaml",
|
||||||
"dom/metrics.yaml",
|
"dom/metrics.yaml",
|
||||||
"dom/performance/metrics.yaml",
|
"dom/performance/metrics.yaml",
|
||||||
|
"dom/push/metrics.yaml",
|
||||||
"dom/security/metrics.yaml",
|
"dom/security/metrics.yaml",
|
||||||
"dom/webauthn/metrics.yaml",
|
"dom/webauthn/metrics.yaml",
|
||||||
"gfx/metrics.yaml",
|
"gfx/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.
|
description: The Bugzilla component which applies to this object.
|
||||||
'Core :: DOM: Performance':
|
'Core :: DOM: Performance':
|
||||||
description: The Bugzilla component which applies to this object.
|
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':
|
'Core :: DOM: Security':
|
||||||
description: The Bugzilla component which applies to this object.
|
description: The Bugzilla component which applies to this object.
|
||||||
'Core :: DOM: Selection':
|
'Core :: DOM: Selection':
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue