Bug 1241699 - Add a telemetry probe measuring sync storage server wipe succeess rate r?markh,bsmedberg
MozReview-Commit-ID: 4BvRep96T3g
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -1503,55 +1503,61 @@ Sync11Service.prototype = {
* @param collections [optional]
* Array of collections to wipe. If not given, all collections are
* wiped by issuing a DELETE request for `storageURL`.
*
* @return the server's timestamp of the (last) DELETE.
*/
wipeServer: function wipeServer(collections) {
let response;
+ let histogram = Services.telemetry.getHistogramById("WEAVE_WIPE_SERVER_SUCCEEDED");
if (!collections) {
// Strip the trailing slash.
let res = this.resource(this.storageURL.slice(0, -1));
res.setHeader("X-Confirm-Delete", "1");
try {
response = res.delete();
} catch (ex) {
this._log.debug("Failed to wipe server", ex);
+ histogram.add(false);
throw ex;
}
if (response.status != 200 && response.status != 404) {
this._log.debug("Aborting wipeServer. Server responded with " +
response.status + " response for " + this.storageURL);
+ histogram.add(false);
throw response;
}
+ histogram.add(true);
return response.headers["x-weave-timestamp"];
}
let timestamp;
for (let name of collections) {
let url = this.storageURL + name;
try {
response = this.resource(url).delete();
} catch (ex) {
this._log.debug("Failed to wipe '" + name + "' collection", ex);
+ histogram.add(false);
throw ex;
}
if (response.status != 200 && response.status != 404) {
this._log.debug("Aborting wipeServer. Server responded with " +
response.status + " response for " + url);
+ histogram.add(false);
throw response;
}
if ("x-weave-timestamp" in response.headers) {
timestamp = response.headers["x-weave-timestamp"];
}
}
-
+ histogram.add(true);
return timestamp;
},
/**
* Wipe all local user data.
*
* @param engines [optional]
* Array of engine names to wipe. If not given, all engines are used.
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -7834,16 +7834,23 @@
},
"WEAVE_COMPLETE_SUCCESS_COUNT": {
"expires_in_version": "default",
"kind": "exponential",
"high": 1000,
"n_buckets": 10,
"description": "The number of times a sync successfully completed in this session"
},
+ "WEAVE_WIPE_SERVER_SUCCEEDED": {
+ "expires_in_version": "55",
+ "alert_emails": ["fx-team@mozilla.com"],
+ "kind": "boolean",
+ "bug_numbers": [1241699],
+ "description": "Stores 1 if a wipeServer call succeeded, and 0 if it failed."
+ },
"WEBCRYPTO_EXTRACTABLE_IMPORT": {
"expires_in_version": "never",
"kind": "boolean",
"description": "Whether an imported key was marked as extractable"
},
"WEBCRYPTO_EXTRACTABLE_GENERATE": {
"expires_in_version": "never",
"kind": "boolean",