Bug 1526895 - Calculate process creation timestamp once r=chutten

Differential Revision: https://phabricator.services.mozilla.com/D19358

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan-Erik Rediger 2019-02-11 14:39:57 +00:00
Родитель 438b2833fc
Коммит a880004810
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -65,6 +65,8 @@ var TelemetryEventPing = {
// So that if we quickly reach the max limit we can immediately send.
_lastSendTime: -DEFAULT_MIN_FREQUENCY_MS,
_processStartTimestamp: 0,
get dataset() {
return Telemetry.canRecordPrereleaseData ? Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN
: Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTOUT;
@ -75,6 +77,10 @@ var TelemetryEventPing = {
return;
}
this._log.trace("Starting up.");
// Calculate process creation once.
this._processStartTimestamp = Math.round((Date.now() - TelemetryUtils.monotonicNow()) / MS_IN_A_MINUTE) * MS_IN_A_MINUTE;
Services.obs.addObserver(this, EVENT_LIMIT_REACHED_TOPIC);
XPCOMUtils.defineLazyPreferenceGetter(this, "maxEventsPerPing",
@ -165,11 +171,9 @@ var TelemetryEventPing = {
// The reason doesn't matter as it will just be echo'd back.
let sessionMeta = TelemetrySession.getMetadata(reason);
let processStartTimestamp = Math.round((Date.now() - TelemetryUtils.monotonicNow()) / MS_IN_A_MINUTE) * MS_IN_A_MINUTE;
let payload = {
reason,
processStartTimestamp,
processStartTimestamp: this._processStartTimestamp,
sessionId: sessionMeta.sessionId,
subsessionId: sessionMeta.subsessionId,
lostEventsCount: 0,