Bug 1715858 - Part2. Add telemetry scalars to count the tab unload and reload events. r=NeilDeakin

This patch adds two scalars:

* `browser.engagement.tab_unload_count`: Incremented by 1 when TabUnloader
  successfully unloaded a tab.
* `browser.engagement.tab_reload_count`: Incremented by 1 when an unloaded
  tab was reloaded.

The value of `browser.engagement.tab_reload_count` will be the same as
the count of the histogram `TAB_UNLOAD_TO_RELOAD` data, but we still need
this scalar to compare it to `browser.engagement.tab_unload_count`, which
tells us the ratio of reload-after-unload tabs to all unloaded tabs.

Depends on D120019

Differential Revision: https://phabricator.services.mozilla.com/D120020
This commit is contained in:
Toshihito Kikuchi 2021-07-22 21:15:00 +00:00
parent a7bf50d1d1
commit 641797c018
2 changed files with 32 additions and 0 deletions

View File

@ -267,6 +267,7 @@
updateLastUnloadedByTabUnloader() {
this._lastUnloaded = Date.now();
Services.telemetry.scalarAdd("browser.engagement.tab_unload_count", 1);
}
recordTimeFromUnloadToReload() {
@ -278,6 +279,7 @@
Services.telemetry
.getHistogramById("TAB_UNLOAD_TO_RELOAD")
.add(diff_in_msec / 1000);
Services.telemetry.scalarAdd("browser.engagement.tab_reload_count", 1);
delete this._lastUnloaded;
}

View File

@ -231,6 +231,36 @@ browser.engagement:
record_in_processes:
- 'main'
tab_unload_count:
bug_numbers:
- 1715858
description: >
The count of tab unload events by TabUnloader due to a low-memory situation.
expires: never
kind: uint
notification_emails:
- tkikuchi@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- 'main'
tab_reload_count:
bug_numbers:
- 1715858
description: >
The count of tab reload events by the user after unloaded.
expires: never
kind: uint
notification_emails:
- tkikuchi@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- 'main'
total_uri_count:
bug_numbers:
- 1271313