зеркало из https://github.com/mozilla/gecko-dev.git
Bug 720456 - Include more startup-relevant information in telemetry pings. r=taras
This commit is contained in:
Родитель
d8d5b9654f
Коммит
9ab233744b
|
@ -182,6 +182,9 @@ TelemetryPing.prototype = {
|
|||
// Generate a unique id once per session so the server can cope with
|
||||
// duplicate submissions.
|
||||
_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
|
||||
|
@ -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 sqlite_re = /SQLITE/;
|
||||
let snapshots = Telemetry.histogramSnapshots;
|
||||
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);
|
||||
}
|
||||
}
|
||||
this._slowSQLStartup = Telemetry.slowSQL;
|
||||
},
|
||||
|
||||
getSessionPayloadAndSlug: function getSessionPayloadAndSlug(reason) {
|
||||
|
@ -404,6 +418,10 @@ TelemetryPing.prototype = {
|
|||
histograms: this.getHistograms(),
|
||||
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) };
|
||||
},
|
||||
|
@ -546,7 +564,7 @@ TelemetryPing.prototype = {
|
|||
}
|
||||
break;
|
||||
case "sessionstore-windows-restored":
|
||||
this.gatherStartupSqlite();
|
||||
this.gatherStartupInformation();
|
||||
break;
|
||||
case "idle-daily":
|
||||
// Enqueue to main-thread, otherwise components may be inited by the
|
||||
|
@ -561,6 +579,7 @@ TelemetryPing.prototype = {
|
|||
break;
|
||||
case "get-payload":
|
||||
this.gatherMemory();
|
||||
this.gatherStartupInformation();
|
||||
let data = this.getSessionPayloadAndSlug("gather-payload");
|
||||
|
||||
aSubject.QueryInterface(Ci.nsISupportsString).data = data.payload;
|
||||
|
|
|
@ -29,8 +29,8 @@ var gFinished = false;
|
|||
|
||||
function telemetry_ping () {
|
||||
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, "test-ping", SERVER);
|
||||
}
|
||||
|
||||
function nonexistentServerObserver(aSubject, aTopic, aData) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче