Bug 860846 - part 3 - send telemetry pings to new, partitioned URLs; r=vladan
authorNathan Froyd <froydnj@mozilla.com>
Wed, 19 Jun 2013 11:44:11 -0400
changeset 147449 333116f6b84cb68939ddac1b85046a59273bcc67
parent 147448 e7fde4431ee10c1c9d8aae6f21cb5921e0fe6816
child 147450 8e45ee13624cb84e78d6d7c210e28e1ae8ffab5b
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvladan
bugs860846
milestone24.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 860846 - part 3 - send telemetry pings to new, partitioned URLs; r=vladan
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
@@ -671,20 +671,24 @@ TelemetryPing.prototype = {
         file.remove(true);
       } catch(e) {
       }
     }
   },
 
   submissionPath: function submissionPath(ping) {
     let slug;
-    if (!ping || ping.reason == "test-ping") {
+    if (!ping) {
       slug = this._uuid;
     } else {
-      slug = ping.slug;
+      let info = ping.payload.info;
+      let pathComponents = [ping.slug, info.reason, info.appName,
+                            info.appVersion, info.appUpdateChannel,
+                            info.appBuildID];
+      slug = pathComponents.join("/");
     }
     return "/submit/telemetry/" + slug;
   },
 
   doPing: function doPing(server, ping, onSuccess, onError) {
     let url = server + this.submissionPath(ping);
     let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
                   .createInstance(Ci.nsIXMLHttpRequest);
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
@@ -193,18 +193,21 @@ function checkPayloadInfo(payload, reaso
     }
   }
   catch (x) {
   }
 }
 
 function checkPayload(request, reason, successfulPings) {
   let payload = decodeRequestPayload(request);
+  // Take off ["","submit","telemetry"].
+  let pathComponents = request.path.split("/").slice(3);
 
   checkPayloadInfo(payload, reason);
+  do_check_eq(reason, pathComponents[1]);
   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);
   do_check_true("maximalNumberOfConcurrentThreads" in payload.simpleMeasurements);
   do_check_true(payload.simpleMeasurements.maximalNumberOfConcurrentThreads >= gNumberOfThreadsLaunched);