Bug 1935420 - Migrate histograms to use Glean APIs for BFCACHE_*, r=chutten.

Differential Revision: https://phabricator.services.mozilla.com/D234182
This commit is contained in:
Florian Quèze
2025-01-27 13:47:11 +00:00
parent 0b414b3183
commit 9bb52886b8
2 changed files with 92 additions and 27 deletions

View File

@@ -27,3 +27,61 @@ performance.page:
- perf-telemetry-alerts@mozilla.com - perf-telemetry-alerts@mozilla.com
- bdekoz@mozilla.com - bdekoz@mozilla.com
expires: never expires: never
bfcache:
combo:
type: labeled_counter
description: >
The common combinations of BFCacheStatus when we determine whether the
page can be BFCached or not; If it's BFCached, we record BFCache_Success;
Success_Not_Toplevel represents the number of not the only top level
document in BrowsingContextGroup's documents that are BFCached, and
BFCache_Success includes Success_Not_Toplevel; If it's not and it falls
under common failure reasons combinations, we record the corresponding
combination; Otherwise, we record Other to indicate this is not a common
failure
This metric was generated to correspond to the Legacy Telemetry
categorical histogram BFCACHE_COMBO.
labels:
- BFCache_Success
- Success_Not_Toplevel
- Unload
- Unload_Req
- Req
- Unload_Req_Peer
- Unload_Req_Peer_MSE
- Unload_Req_MSE
- SPD_Unload_Req_Peer
- Remote_Subframes
- Beforeunload
- Other
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1531917
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1531917
notification_emails:
- sefeng@mozilla.com
expires: never
telemetry_mirror: h#BFCACHE_COMBO
page_restored:
type: labeled_counter
description: >
Whether bfcache is used when loading a page from session history
This metric was generated to correspond to the Legacy Telemetry boolean
histogram BFCACHE_PAGE_RESTORED.
labels:
- "false"
- "true"
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1531917
- https://bugzilla.mozilla.org/show_bug.cgi?id=1551935
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1531917
- https://bugzilla.mozilla.org/show_bug.cgi?id=1551935
notification_emails:
- sefeng@mozilla.com
expires: never
telemetry_mirror: h#BFCACHE_PAGE_RESTORED

View File

@@ -6764,56 +6764,59 @@ void nsDocShell::ReportBFCacheComboTelemetry(uint32_t aCombo) {
} }
switch (aCombo) { switch (aCombo) {
case BFCACHE_SUCCESS: case BFCACHE_SUCCESS:
Telemetry::AccumulateCategorical( glean::bfcache::combo.EnumGet(glean::bfcache::ComboLabel::eBfcacheSuccess)
Telemetry::LABELS_BFCACHE_COMBO::BFCache_Success); .Add();
break; break;
case NOT_ONLY_TOPLEVEL: case NOT_ONLY_TOPLEVEL:
if (StaticPrefs::docshell_shistory_bfcache_require_no_opener()) { if (StaticPrefs::docshell_shistory_bfcache_require_no_opener()) {
Telemetry::AccumulateCategorical( glean::bfcache::combo.EnumGet(glean::bfcache::ComboLabel::eOther).Add();
Telemetry::LABELS_BFCACHE_COMBO::Other);
break; break;
} }
Telemetry::AccumulateCategorical( glean::bfcache::combo.EnumGet(glean::bfcache::ComboLabel::eBfcacheSuccess)
Telemetry::LABELS_BFCACHE_COMBO::BFCache_Success); .Add();
Telemetry::AccumulateCategorical( glean::bfcache::combo
Telemetry::LABELS_BFCACHE_COMBO::Success_Not_Toplevel); .EnumGet(glean::bfcache::ComboLabel::eSuccessNotToplevel)
.Add();
break; break;
case UNLOAD: case UNLOAD:
Telemetry::AccumulateCategorical(Telemetry::LABELS_BFCACHE_COMBO::Unload); glean::bfcache::combo.EnumGet(glean::bfcache::ComboLabel::eUnload).Add();
break; break;
case BEFOREUNLOAD: case BEFOREUNLOAD:
Telemetry::AccumulateCategorical( glean::bfcache::combo.EnumGet(glean::bfcache::ComboLabel::eBeforeunload)
Telemetry::LABELS_BFCACHE_COMBO::Beforeunload); .Add();
break; break;
case UNLOAD_REQUEST: case UNLOAD_REQUEST:
Telemetry::AccumulateCategorical( glean::bfcache::combo.EnumGet(glean::bfcache::ComboLabel::eUnloadReq)
Telemetry::LABELS_BFCACHE_COMBO::Unload_Req); .Add();
break; break;
case REQUEST: case REQUEST:
Telemetry::AccumulateCategorical(Telemetry::LABELS_BFCACHE_COMBO::Req); glean::bfcache::combo.EnumGet(glean::bfcache::ComboLabel::eReq).Add();
break; break;
case UNLOAD_REQUEST_PEER: case UNLOAD_REQUEST_PEER:
Telemetry::AccumulateCategorical( glean::bfcache::combo.EnumGet(glean::bfcache::ComboLabel::eUnloadReqPeer)
Telemetry::LABELS_BFCACHE_COMBO::Unload_Req_Peer); .Add();
break; break;
case UNLOAD_REQUEST_PEER_MSE: case UNLOAD_REQUEST_PEER_MSE:
Telemetry::AccumulateCategorical( glean::bfcache::combo
Telemetry::LABELS_BFCACHE_COMBO::Unload_Req_Peer_MSE); .EnumGet(glean::bfcache::ComboLabel::eUnloadReqPeerMse)
.Add();
break; break;
case UNLOAD_REQUEST_MSE: case UNLOAD_REQUEST_MSE:
Telemetry::AccumulateCategorical( glean::bfcache::combo.EnumGet(glean::bfcache::ComboLabel::eUnloadReqMse)
Telemetry::LABELS_BFCACHE_COMBO::Unload_Req_MSE); .Add();
break; break;
case SUSPENDED_UNLOAD_REQUEST_PEER: case SUSPENDED_UNLOAD_REQUEST_PEER:
Telemetry::AccumulateCategorical( glean::bfcache::combo
Telemetry::LABELS_BFCACHE_COMBO::SPD_Unload_Req_Peer); .EnumGet(glean::bfcache::ComboLabel::eSpdUnloadReqPeer)
.Add();
break; break;
case REMOTE_SUBFRAMES: case REMOTE_SUBFRAMES:
Telemetry::AccumulateCategorical( glean::bfcache::combo
Telemetry::LABELS_BFCACHE_COMBO::Remote_Subframes); .EnumGet(glean::bfcache::ComboLabel::eRemoteSubframes)
.Add();
break; break;
default: default:
Telemetry::AccumulateCategorical(Telemetry::LABELS_BFCACHE_COMBO::Other); glean::bfcache::combo.EnumGet(glean::bfcache::ComboLabel::eOther).Add();
break; break;
} }
}; };
@@ -9509,10 +9512,14 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
bool restoring; bool restoring;
rv = RestorePresentation(aLoadState->SHEntry(), &restoring); rv = RestorePresentation(aLoadState->SHEntry(), &restoring);
if (restoring) { if (restoring) {
Telemetry::Accumulate(Telemetry::BFCACHE_PAGE_RESTORED, true); glean::bfcache::page_restored
.EnumGet(glean::bfcache::PageRestoredLabel::eTrue)
.Add();
return rv; return rv;
} }
Telemetry::Accumulate(Telemetry::BFCACHE_PAGE_RESTORED, false); glean::bfcache::page_restored
.EnumGet(glean::bfcache::PageRestoredLabel::eFalse)
.Add();
// We failed to restore the presentation, so clean up. // We failed to restore the presentation, so clean up.
// Both the old and new history entries could potentially be in // Both the old and new history entries could potentially be in