Bug 772552 - Adds Telemetry for saved pings. r=nfroyd
authorAaron Klotz <aklotz@mozilla.com>
Mon, 29 Oct 2012 15:12:03 -0400
changeset 111694 5a346b5852559c6186649680195cd3e55b96a124
parent 111693 26095585dc5b018d88b8b600f8dae0117e567ceb
child 111695 4ee6b1acd5ea36e402f3b5ebe23a755275e51366
push id23770
push userryanvm@gmail.com
push dateTue, 30 Oct 2012 14:48:50 +0000
treeherdermozilla-central@71290adea0c1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnfroyd
bugs772552
milestone19.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 772552 - Adds Telemetry for saved pings. r=nfroyd
toolkit/components/telemetry/TelemetryPing.js
toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
--- a/toolkit/components/telemetry/TelemetryPing.js
+++ b/toolkit/components/telemetry/TelemetryPing.js
@@ -505,16 +505,25 @@ TelemetryPing.prototype = {
     if (Object.keys(this._slowSQLStartup.mainThread).length
 	|| Object.keys(this._slowSQLStartup.otherThreads).length) {
       payloadObj.slowSQLStartup = this._slowSQLStartup;
     }
     
     for (let ioCounter in this._startupIO)
       payloadObj.simpleMeasurements[ioCounter] = this._startupIO[ioCounter];
 
+    let hasPingBeenSent = false;
+    try {
+      hasPingBeenSent = Telemetry.getHistogramById("TELEMETRY_SUCCESS").snapshot().sum > 0;
+    } catch(e) {
+    }
+    if (reason != "saved-session" || hasPingBeenSent) {
+      payloadObj.simpleMeasurements.savedPings = this._pingsLoaded;
+    }
+
     let slug = (isTestPing ? reason : this._uuid);
     payloadObj.info = this.getMetadata(reason);
     return { slug: slug, payload: JSON.stringify(payloadObj) };
   },
 
   getPayloads: function getPayloads(reason) {
     function payloadIter() {
       yield this.getCurrentSessionPayloadAndSlug(reason);
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
@@ -175,16 +175,17 @@ function checkPayloadInfo(payload, reaso
 function checkPayload(request, reason, successfulPings) {
   let payload = decodeRequestPayload(request);
 
   checkPayloadInfo(payload, reason);
   do_check_eq(request.getHeader("content-type"), "application/json; charset=UTF-8");
   do_check_true(payload.simpleMeasurements.uptime >= 0);
   do_check_true(payload.simpleMeasurements.startupInterrupted === 1);
   do_check_eq(payload.simpleMeasurements.shutdownDuration, SHUTDOWN_TIME);
+  do_check_eq(payload.simpleMeasurements.savedPings, 1);
 
   var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
   if (isWindows) {
     do_check_true(payload.simpleMeasurements.startupSessionRestoreReadBytes > 0);
     do_check_true(payload.simpleMeasurements.startupSessionRestoreWriteBytes > 0);
   }
 
   const TELEMETRY_PING = "TELEMETRY_PING";