Bug 1241699 - Add a telemetry probe measuring sync storage server wipe succeess rate. r=markh r=bsmedberg
authorThom Chiovoloni <tchiovoloni@mozilla.com>
Wed, 13 Jul 2016 12:18:34 -0400
changeset 308396 47d39d542c7db01d1ef803508bc95307fd8a4638
parent 308395 fff9d624dca283235c916d8769786e04f5622282
child 308397 19bf95d3e65ebebaa4d57984264c5f6a0788e190
push id80334
push userkwierso@gmail.com
push dateFri, 05 Aug 2016 21:06:09 +0000
treeherdermozilla-inbound@12b31a12d10a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh, bsmedberg
bugs1241699
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1241699 - Add a telemetry probe measuring sync storage server wipe succeess rate. r=markh r=bsmedberg MozReview-Commit-ID: 4BvRep96T3g
services/sync/modules/service.js
toolkit/components/telemetry/Histograms.json
--- 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",