Some additional debugging info and fixes

This commit is contained in:
Rehan Dalal 2018-01-30 20:30:14 -05:00
Родитель 3cc9dc4388
Коммит 53d0732458
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 410D198EEF339E0B
3 изменённых файлов: 29 добавлений и 16 удалений

4
extension/bootstrap.js поставляемый
Просмотреть файл

@ -60,7 +60,7 @@ this.Bootstrap = {
timestamp: Math.round(Date.now() / 1000),
context: `${reason}`,
};
await Pioneer.utils.submitEncryptedPing("pathfinder-event", 1, payload);
await Pioneer.submitEncryptedPing("pathfinder-event", 1, payload);
// Always set EXPIRATION_DATE_PREF if it not set, even if outside of install.
// This is a failsafe if opt-out expiration doesn't work, so should be resilient.
@ -114,7 +114,7 @@ this.Bootstrap = {
timestamp: Math.round(Date.now() / 1000),
context: `${reason}`,
};
await Pioneer.utils.submitEncryptedPing("pathfinder-event", 1, payload);
await Pioneer.submitEncryptedPing("pathfinder-event", 1, payload);
if (isStartupFinished) {
LogHandler.shutdown();

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

@ -39,7 +39,8 @@ let intervalId;
this.LogHandler = {
startup() {
this.uploadPings();
this.uploadPings("timer");
this.uploadPings("interval");
// Timers done the way they were in the online news study
intervalId = setInterval(this.handleInterval.bind(this), Config.logUploadAttemptInterval);
@ -63,7 +64,7 @@ this.LogHandler = {
timestamp: Math.round(Date.now() / 1000),
context: "",
};
await Pioneer.utils.submitEncryptedPing("pathfinder-event", 1, payload);
await Pioneer.submitEncryptedPing("pathfinder-event", 1, payload);
this.uploadPings("interval");
},
@ -73,7 +74,7 @@ this.LogHandler = {
timestamp: Math.round(Date.now() / 1000),
context: "",
};
await Pioneer.utils.submitEncryptedPing("pathfinder-log", 1, payload);
await Pioneer.submitEncryptedPing("pathfinder-event", 1, payload);
this.uploadPings("timer");
},
@ -104,18 +105,18 @@ this.LogHandler = {
perEntryPingSizeIncrease[type] = sizeDelta;
}
const entryCount = Math.ceil(entriesMinSize / sizeDelta);
const entryCount = Math.ceil(entriesMinSize / (sizeDelta * padding));
const entries = Array(entryCount).fill(entry);
await Pioneer.utils.submitEncryptedPing("pathfinder-event", 1, {
eventId: "pingsGenerated",
await Pioneer.submitEncryptedPing("pathfinder-event", 1, {
eventId: `pingsGenerated:${type}`,
timestamp: Math.round(Date.now() / 1000),
context: `${pingCount}`,
});
await Pioneer.utils.submitEncryptedPing("pathfinder-event", 1, {
eventId: "entriesGenerated",
await Pioneer.submitEncryptedPing("pathfinder-event", 1, {
eventId: `entriesGenerated:${type}`,
timestamp: Math.round(Date.now() / 1000),
context: `${entries.length}`,
});
@ -140,11 +141,11 @@ this.LogHandler = {
if (entriesPingSize < UPLOAD_LIMIT) {
// If the ping is small enough, just submit it directly
await Pioneer.utils.submitEncryptedPing("pathfinder-log", 1, payload);
await Pioneer.submitEncryptedPing("pathfinder-log", 1, payload);
PrefUtils.setLongPref(uploadDatePrefName, Date.now());
await Pioneer.utils.submitEncryptedPing("pathfinder-event", 1, {
eventId: "pingsSent",
await Pioneer.submitEncryptedPing("pathfinder-event", 1, {
eventId: `pingsSent:${type}`,
timestamp: Math.round(Date.now() / 1000),
context: "1",
});
@ -174,12 +175,12 @@ this.LogHandler = {
continue;
}
await Pioneer.utils.submitEncryptedPing("pathfinder-log", 1, payload);
await Pioneer.submitEncryptedPing("pathfinder-log", 1, payload);
pingCount++;
}
await Pioneer.utils.submitEncryptedPing("pathfinder-event", 1, {
eventId: "pingsSent",
await Pioneer.submitEncryptedPing("pathfinder-event", 1, {
eventId: `pingsSent:${type}`,
timestamp: Math.round(Date.now() / 1000),
context: `${pingCount}`,
});

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

@ -1,4 +1,5 @@
const { utils: Cu } = Components;
Cu.import("resource://gre/modules/Console.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(
@ -11,6 +12,17 @@ XPCOMUtils.defineLazyModuleGetter(
const Pioneer = {
startup() {
this.utils = new PioneerUtils(Config);
},
submitEncryptedPing(schemaName, schemaVersion, data, options) {
console.log('Ping submitted');
console.log({
schemaName,
schemaVersion,
data,
options,
});
this.utils.submitEncryptedPing(schemaName, schemaVersion, data, options)
}
};