Bug 1522381 - don't rely on Services.startup.getStartupInfo().main for telemetry session start. r=tcsc a=lizzard
authorMark Hammond <mhammond@skippinet.com.au>
Fri, 08 Feb 2019 01:49:33 +0000
changeset 513047 401c1404f3b0
parent 513046 59b12aa8fa46
child 513048 a5083352550a
push id10696
push usernbeleuzu@mozilla.com
push dateThu, 14 Feb 2019 00:48:15 +0000
treeherdermozilla-beta@401c1404f3b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcsc, lizzard
bugs1522381
milestone66.0
Bug 1522381 - don't rely on Services.startup.getStartupInfo().main for telemetry session start. r=tcsc a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D19098
services/sync/modules/telemetry.js
--- a/services/sync/modules/telemetry.js
+++ b/services/sync/modules/telemetry.js
@@ -472,17 +472,22 @@ class SyncTelemetryImpl {
     this.events = [];
     this.histograms = {};
     this.maxEventsCount = Svc.Prefs.get("telemetry.maxEventsCount", 1000);
     this.maxPayloadCount = Svc.Prefs.get("telemetry.maxPayloadCount");
     this.submissionInterval = Svc.Prefs.get("telemetry.submissionInterval") * 1000;
     this.lastSubmissionTime = Telemetry.msSinceProcessStart();
     this.lastUID = EMPTY_UID;
     this.lastDeviceID = undefined;
-    let sessionStartDate = Services.startup.getStartupInfo().main;
+    // Note that the sessionStartDate is somewhat arbitrary - the telemetry
+    // modules themselves just use `new Date()`. This means that our startDate
+    // isn't going to be the same as the sessionStartDate in the main pings,
+    // but that's OK for now - if it's a problem we'd need to change the
+    // telemetry modules to expose what it thinks the sessionStartDate is.
+    let sessionStartDate = new Date();
     this.sessionStartDate = TelemetryUtils.toLocalTimeISOString(
       TelemetryUtils.truncateToHours(sessionStartDate));
   }
 
   getPingJSON(reason) {
     return {
       os: TelemetryEnvironment.currentEnvironment.system.os,
       why: reason,