Bug 1519022 - Display rich data for archived event pings r=chutten
authorJan-Erik Rediger <jrediger@mozilla.com>
Mon, 21 Jan 2019 16:16:07 +0000
changeset 514705 5b7087dac6b99946a4d4aaa9824cea7483088031
parent 514704 ede9544aaf4dcd07a47c7a0b45862497a1f8f34d
child 514706 95779bb379580b2ebf57acef5e400258e4dfa88d
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten
bugs1519022
milestone66.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 1519022 - Display rich data for archived event pings r=chutten Differential Revision: https://phabricator.services.mozilla.com/D17124
toolkit/content/aboutTelemetry.js
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -2436,31 +2436,31 @@ var SimpleMeasurements = {
     for (let key of sortedKeys) {
       result[key] = aSimpleMeasurements[key];
     }
 
     return result;
   },
 };
 
-function renderProcessList(ping, selectEl) {
+function renderProcessList(payload, selectEl) {
   removeAllChildNodes(selectEl);
   let option = document.createElement("option");
   option.appendChild(document.createTextNode("parent"));
   option.setAttribute("value", "parent");
   option.selected = true;
   selectEl.appendChild(option);
 
-  if (!("processes" in ping.payload)) {
+  if (!("processes" in payload)) {
     selectEl.disabled = true;
     return;
   }
   selectEl.disabled = false;
 
-  for (let process of Object.keys(ping.payload.processes)) {
+  for (let process of Object.keys(payload.processes)) {
     // TODO: parent hgrams are on root payload, not in payload.processes.parent
     // When/If that gets moved, you'll need to remove this
     if (process === "parent") {
       continue;
     }
     option = document.createElement("option");
     option.appendChild(document.createTextNode(process));
     option.setAttribute("value", process);
@@ -2501,32 +2501,53 @@ function displayPingData(ping, updatePay
     console.log(err);
     PingPicker._showRawPingData();
   }
 }
 
 function displayRichPingData(ping, updatePayloadList) {
   // Update the payload list and process lists
   if (updatePayloadList) {
-    renderProcessList(ping, document.getElementById("processes"));
+    renderProcessList(ping.payload, document.getElementById("processes"));
   }
 
   // Show general data.
   GeneralData.render(ping);
 
   // Show environment data.
   EnvironmentData.render(ping);
 
   RawPayloadData.render(ping);
 
-  // We only have special rendering code for the payloads from "main" pings.
+  // We have special rendering code for the payloads from "main" and "event" pings.
   // For any other pings we just render the raw JSON payload.
   let isMainPing = (ping.type == "main" || ping.type == "saved-session");
+  let isEventPing = ping.type == "event";
   togglePingSections(isMainPing);
 
+  if (isEventPing) {
+    // Copy the payload, so we don't modify the raw representation
+    let payload = { processes: {} };
+    for (let process of Object.keys(ping.payload.events)) {
+      payload.processes[process] = {
+        events: ping.payload.events[process],
+      };
+    }
+
+    // We transformed the actual payload, let's reload the process list if necessary.
+    if (updatePayloadList) {
+      renderProcessList(payload, document.getElementById("processes"));
+    }
+
+    // Show event data.
+    Events.render(payload);
+    return;
+  }
+
+
   if (!isMainPing) {
     return;
   }
 
   // Show slow SQL stats
   SlowSQL.render(ping);
 
   // Render Addon details.