bug 1367110 - Collect Telemetry for different TelemetrySend failures r=bsmedberg,Dexter data-r=bsmedberg
☠☠ backed out by 83f02ddde71f ☠ ☠
authorChris H-C <chutten@mozilla.com>
Wed, 24 May 2017 10:14:41 -0400
changeset 409700 244e7cfea7317c67c322a2b4fba6c2b2e64feb34
parent 409699 1b93ec532890d3e4d88c730634339a9cfdd4000b
child 409701 5df9b21d7a40944c9a01f75abfa63c7dba183ed4
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg, Dexter
bugs1367110
milestone55.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 1367110 - Collect Telemetry for different TelemetrySend failures r=bsmedberg,Dexter data-r=bsmedberg Expires in 61 for now until we can show its usefulness. MozReview-Commit-ID: IpfEnmnuKgr
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/TelemetrySend.jsm
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -7255,16 +7255,33 @@
     "alert_emails": ["telemetry-client-dev@mozilla.com"],
     "bug_numbers": [1318284],
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 120000,
     "n_buckets": 20,
     "description": "Time needed (in ms) for a failed send of a Telemetry ping to the servers and getting a reply back."
   },
+  "TELEMETRY_SEND_FAILURE_TYPE" : {
+    "record_in_processes": ["main"],
+    "alert_emails": ["telemetry-client-dev@mozilla.com"],
+    "bug_numbers": [1367110],
+    "expires_in_version": "61",
+    "kind": "categorical",
+    "labels": [
+      "eOK",
+      "eRequest",
+      "eUnreachable",
+      "eChannelOpen",
+      "eRedirect",
+      "abort",
+      "timeout"
+    ],
+    "description": "Counts of the different ways sending a Telemetry ping can fail."
+  },
   "TELEMETRY_STRINGIFY" : {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["telemetry-client-dev@mozilla.com"],
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 3000,
     "n_buckets": 10,
     "description": "Time to stringify telemetry object (ms)"
--- a/toolkit/components/telemetry/TelemetrySend.jsm
+++ b/toolkit/components/telemetry/TelemetrySend.jsm
@@ -87,16 +87,26 @@ const SEND_TICK_DELAY = 1 * MS_IN_A_MINU
 // for the next ping sends. We increase the delay exponentially up to a limit of
 // SEND_MAXIMUM_BACKOFF_DELAY_MS.
 // This exponential backoff will be reset by external ping submissions & idle-daily.
 const SEND_MAXIMUM_BACKOFF_DELAY_MS = 120 * MS_IN_A_MINUTE;
 
 // The age of a pending ping to be considered overdue (in milliseconds).
 const OVERDUE_PING_FILE_AGE = 7 * 24 * 60 * MS_IN_A_MINUTE; // 1 week
 
+// Strings to map from XHR.errorCode to TELEMETRY_SEND_FAILURE_TYPE.
+// Echoes XMLHttpRequestMainThread's ErrorType enum.
+const XHR_ERROR_TYPE = [
+  'eOK',
+  'eRequest',
+  'eUnreachable',
+  'eChannelOpen',
+  'eRedirect',
+];
+
 function monotonicNow() {
   try {
     return Telemetry.msSinceProcessStart();
   } catch (ex) {
     // If this fails fall back to the (non-monotonic) Date value.
     return Date.now();
   }
 }
@@ -1102,17 +1112,23 @@ var TelemetrySendImpl = {
         .then(() => onCompletion(),
               (error) => {
                 this._log.error("_doPing - request success: " + success + ", error: " + error);
                 onCompletion();
               });
     };
 
     let errorhandler = (event) => {
-      this._log.error("_doPing - error making request to " + url + ": " + event.type);
+      let failure = event.type;
+      if (failure === 'error') {
+        failure = XHR_ERROR_TYPE[request.errorCode];
+      }
+      Telemetry.getHistogramById("TELEMETRY_SEND_FAILURE_TYPE").add(failure);
+
+      this._log.error("_doPing - error making request to " + url + ": " + failure);
       onRequestFinished(false, event);
     };
     request.onerror = errorhandler;
     request.ontimeout = errorhandler;
     request.onabort = errorhandler;
 
     request.onload = (event) => {
       let status = request.status;