bug 1438896 : Test patch draft
authorakriti <akriti.v10@gmail.com>
Mon, 02 Apr 2018 19:36:34 +0530
changeset 776024 75ec7a99111b6937905400f833ca94e9fdf628cf
parent 765972 8863806b9e28e9a5267c34c2e000f3cc0265f944
push id104786
push userbmo:akriti.v10@gmail.com
push dateMon, 02 Apr 2018 14:09:49 +0000
bugs1438896
milestone60.0a1
bug 1438896 : Test patch MozReview-Commit-ID: AhDCz5uNKQ6
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/TelemetrySend.jsm
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -7225,31 +7225,34 @@
     "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" : {
+  "TELEMETRY_SEND_PING_TYPE" : {
     "record_in_processes": ["main"],
     "alert_emails": ["telemetry-client-dev@mozilla.com", "chutten@mozilla.com"],
-    "bug_numbers": [1367110],
+    "bug_numbers": [1438896],
     "expires_in_version": "66",
     "kind": "categorical",
+    "keyed": true,
     "labels": [
-      "eOK",
-      "eRequest",
-      "eUnreachable",
-      "eChannelOpen",
-      "eRedirect",
-      "abort",
-      "timeout",
-      "eTooLate"
+      "main",
+      "activation",
+      "deletion",
+      "core",
+      "crash",
+      "health",
+      "heartbeat",
+      "modules",
+      "sync",
+      "update"
     ],
     "description": "Counts of the different ways sending a Telemetry ping can fail."
   },
   "TELEMETRY_STRINGIFY" : {
     "record_in_processes": ["main"],
     "alert_emails": ["telemetry-client-dev@mozilla.com"],
     "expires_in_version": "never",
     "kind": "exponential",
--- a/toolkit/components/telemetry/TelemetrySend.jsm
+++ b/toolkit/components/telemetry/TelemetrySend.jsm
@@ -82,17 +82,16 @@ 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",
 ];
@@ -785,17 +784,17 @@ var TelemetrySendImpl = {
     this._tooLateToSend = false;
     this._isOSShutdown = false;
     this._sendingEnabled = true;
 
     const histograms = [
       "TELEMETRY_SUCCESS",
       "TELEMETRY_SEND_SUCCESS",
       "TELEMETRY_SEND_FAILURE",
-      "TELEMETRY_SEND_FAILURE_TYPE",
+      "TELEMETRY_SEND_PING_TYPE",
     ];
 
     histograms.forEach(h => Telemetry.getHistogramById(h).clear());
 
     return SendScheduler.reset();
   },
 
   /**
@@ -1099,17 +1098,17 @@ var TelemetrySendImpl = {
       // We can't send the pings to the server, so don't try to.
       this._log.trace("_doPing - Can't send ping " + ping.id);
       return Promise.resolve();
     }
 
     if (this._tooLateToSend) {
       // Too late to send now. Reject so we pend the ping to send it next time.
       this._log.trace("_doPing - Too late to send ping " + ping.id);
-      Telemetry.getHistogramById("TELEMETRY_SEND_FAILURE_TYPE").add("eTooLate");
+      Telemetry.getHistogramById("TELEMETRY_SEND_PING_TYPE").add(ping.type);
       return Promise.reject();
     }
 
     this._log.trace("_doPing - server: " + this._server + ", persisted: " + isPersisted +
                     ", id: " + id);
 
     const url = this._buildSubmissionURL(ping);
 
@@ -1154,17 +1153,17 @@ var TelemetrySendImpl = {
 
     let errorhandler = (event) => {
       let failure = event.type;
       if (failure === "error") {
         failure = XHR_ERROR_TYPE[request.errorCode];
       }
 
       TelemetryHealthPing.recordSendFailure(failure);
-      Telemetry.getHistogramById("TELEMETRY_SEND_FAILURE_TYPE").add(failure);
+      Telemetry.getHistogramById("TELEMETRY_SEND_PING_TYPE").add(ping.type);
 
       this._log.error("_doPing - error making request to " + url + ": " + failure);
       onRequestFinished(false, event);
     };
     request.onerror = errorhandler;
     request.ontimeout = errorhandler;
     request.onabort = errorhandler;