mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 721020 - [New Tab Page] Add telemetry probes r=ttaubert
This commit is contained in:
parent
4fbada08f4
commit
db4a915135
@ -27,6 +27,9 @@ const PREF_NEWTAB_ENABLED = "browser.newtabpage.enabled";
|
||||
// The maximum number of results we want to retrieve from history.
|
||||
const HISTORY_RESULTS_LIMIT = 100;
|
||||
|
||||
// The gather telemetry topic.
|
||||
const TOPIC_GATHER_TELEMETRY = "gather-telemetry";
|
||||
|
||||
/**
|
||||
* Singleton that provides storage functionality.
|
||||
*/
|
||||
@ -585,6 +588,47 @@ let Links = {
|
||||
Ci.nsISupportsWeakReference])
|
||||
};
|
||||
|
||||
/**
|
||||
* Singleton used to collect telemetry data.
|
||||
*
|
||||
*/
|
||||
let Telemetry = {
|
||||
/**
|
||||
* Initializes object.
|
||||
*/
|
||||
init: function Telemetry_init() {
|
||||
Services.obs.addObserver(this, TOPIC_GATHER_TELEMETRY, false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Collects data.
|
||||
*/
|
||||
_collect: function Telemetry_collect() {
|
||||
let probes = [
|
||||
{ histogram: "NEWTAB_PAGE_ENABLED",
|
||||
value: AllPages.enabled },
|
||||
{ histogram: "NEWTAB_PAGE_PINNED_SITES_COUNT",
|
||||
value: PinnedLinks.links.length },
|
||||
{ histogram: "NEWTAB_PAGE_BLOCKED_SITES_COUNT",
|
||||
value: Object.keys(BlockedLinks.links).length }
|
||||
];
|
||||
|
||||
probes.forEach(function Telemetry_collect_forEach(aProbe) {
|
||||
Services.telemetry.getHistogramById(aProbe.histogram)
|
||||
.add(aProbe.value);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Listens for gather telemetry topic.
|
||||
*/
|
||||
observe: function Telemetry_observe(aSubject, aTopic, aData) {
|
||||
this._collect();
|
||||
}
|
||||
};
|
||||
|
||||
Telemetry.init();
|
||||
|
||||
/**
|
||||
* Singleton that provides the public API of this JSM.
|
||||
*/
|
||||
|
@ -434,6 +434,13 @@ HISTOGRAM_FLAG(TELEMETRY_TEST_FLAG, "a testing histogram; not meant to be touche
|
||||
HISTOGRAM_FLAG(STARTUP_CRASH_DETECTED, "Whether there was a crash during the last startup")
|
||||
HISTOGRAM_ENUMERATED_VALUES(SAFE_MODE_USAGE, 3, "Whether the user is in safe mode (No, Yes, Forced)")
|
||||
|
||||
/**
|
||||
* New Tab Page telemetry.
|
||||
*/
|
||||
HISTOGRAM(NEWTAB_PAGE_ENABLED, 0, 1, 2, BOOLEAN, "New tab page is enabled.")
|
||||
HISTOGRAM(NEWTAB_PAGE_PINNED_SITES_COUNT, 1, 9, 10, EXPONENTIAL, "Number of pinned sites on the new tab page.")
|
||||
HISTOGRAM(NEWTAB_PAGE_BLOCKED_SITES_COUNT, 1, 100, 10, EXPONENTIAL, "Number of sites blocked from the new tab page.")
|
||||
|
||||
/**
|
||||
* Native Fennec Telemetry
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user