зеркало из https://github.com/mozilla/pjs.git
Bug 720456 - Include more startup-relevant information in telemetry pings. r=taras
This commit is contained in:
Родитель
927e7d8977
Коммит
a19d31220d
|
@ -182,6 +182,9 @@ TelemetryPing.prototype = {
|
||||||
// Generate a unique id once per session so the server can cope with
|
// Generate a unique id once per session so the server can cope with
|
||||||
// duplicate submissions.
|
// duplicate submissions.
|
||||||
_uuid: generateUUID(),
|
_uuid: generateUUID(),
|
||||||
|
// Regex that matches histograms we carea bout during startup.
|
||||||
|
_startupHistogramRegex: /SQLITE|HTTP|SPDY|CACHE|DNS/,
|
||||||
|
_slowSQLStartup: {},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a set of histograms that can be converted into JSON
|
* Returns a set of histograms that can be converted into JSON
|
||||||
|
@ -383,15 +386,26 @@ TelemetryPing.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a copy of sqlite histograms on startup
|
* Return true if we're interested in having a STARTUP_* histogram for
|
||||||
|
* the given histogram name.
|
||||||
*/
|
*/
|
||||||
gatherStartupSqlite: function gatherStartupSqlite() {
|
isInterestingStartupHistogram: function isInterestingStartupHistogram(name) {
|
||||||
|
return this._startupHistogramRegex.test(name);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a copy of interesting histograms at startup.
|
||||||
|
*/
|
||||||
|
gatherStartupInformation: function gatherStartupInformation() {
|
||||||
let info = Telemetry.registeredHistograms;
|
let info = Telemetry.registeredHistograms;
|
||||||
let sqlite_re = /SQLITE/;
|
let snapshots = Telemetry.histogramSnapshots;
|
||||||
for (let name in info) {
|
for (let name in info) {
|
||||||
if (sqlite_re.test(name))
|
// Only duplicate histograms with actual data.
|
||||||
|
if (this.isInterestingStartupHistogram(name) && name in snapshots) {
|
||||||
Telemetry.histogramFrom("STARTUP_" + name, name);
|
Telemetry.histogramFrom("STARTUP_" + name, name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
this._slowSQLStartup = Telemetry.slowSQL;
|
||||||
},
|
},
|
||||||
|
|
||||||
getSessionPayloadAndSlug: function getSessionPayloadAndSlug(reason) {
|
getSessionPayloadAndSlug: function getSessionPayloadAndSlug(reason) {
|
||||||
|
@ -404,6 +418,10 @@ TelemetryPing.prototype = {
|
||||||
histograms: this.getHistograms(),
|
histograms: this.getHistograms(),
|
||||||
slowSQL: Telemetry.slowSQL
|
slowSQL: Telemetry.slowSQL
|
||||||
};
|
};
|
||||||
|
if (Object.keys(this._slowSQLStartup.mainThread).length
|
||||||
|
|| Object.keys(this._slowSQLStartup.otherThreads).length) {
|
||||||
|
payloadObj.slowSQLStartup = this._slowSQLStartup;
|
||||||
|
}
|
||||||
|
|
||||||
return { slug: slug, payload: JSON.stringify(payloadObj) };
|
return { slug: slug, payload: JSON.stringify(payloadObj) };
|
||||||
},
|
},
|
||||||
|
@ -546,7 +564,7 @@ TelemetryPing.prototype = {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "sessionstore-windows-restored":
|
case "sessionstore-windows-restored":
|
||||||
this.gatherStartupSqlite();
|
this.gatherStartupInformation();
|
||||||
break;
|
break;
|
||||||
case "idle-daily":
|
case "idle-daily":
|
||||||
// Enqueue to main-thread, otherwise components may be inited by the
|
// Enqueue to main-thread, otherwise components may be inited by the
|
||||||
|
@ -561,6 +579,7 @@ TelemetryPing.prototype = {
|
||||||
break;
|
break;
|
||||||
case "get-payload":
|
case "get-payload":
|
||||||
this.gatherMemory();
|
this.gatherMemory();
|
||||||
|
this.gatherStartupInformation();
|
||||||
let data = this.getSessionPayloadAndSlug("gather-payload");
|
let data = this.getSessionPayloadAndSlug("gather-payload");
|
||||||
|
|
||||||
aSubject.QueryInterface(Ci.nsISupportsString).data = data.payload;
|
aSubject.QueryInterface(Ci.nsISupportsString).data = data.payload;
|
||||||
|
|
|
@ -29,8 +29,8 @@ var gFinished = false;
|
||||||
|
|
||||||
function telemetry_ping () {
|
function telemetry_ping () {
|
||||||
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsIObserver);
|
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsIObserver);
|
||||||
TelemetryPing.observe(null, "test-ping", SERVER);
|
|
||||||
TelemetryPing.observe(null, "sessionstore-windows-restored", null);
|
TelemetryPing.observe(null, "sessionstore-windows-restored", null);
|
||||||
|
TelemetryPing.observe(null, "test-ping", SERVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
function nonexistentServerObserver(aSubject, aTopic, aData) {
|
function nonexistentServerObserver(aSubject, aTopic, aData) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче