Bug 1868145 - Record telemetry for how often we display the Captive Portal banner to users r=necko-reviewers,jesup,valentin

Collect scalars on key captive portal events so we can better understand usage.

Differential Revision: https://phabricator.services.mozilla.com/D195816
This commit is contained in:
Andrew Creskey 2024-01-22 14:33:42 +00:00
parent d4f85b52d9
commit ef6dd39d7f
2 changed files with 70 additions and 0 deletions

View File

@ -26,6 +26,9 @@ var CaptivePortalWatcher = {
// after successful login if we're redirected to the canonicalURL.
_previousCaptivePortalTab: null,
// Stores the time at which the banner was displayed
_bannerDisplayTime: Date.now(),
get _captivePortalNotification() {
return gNotificationBox.getNotificationWithValue(
this.PORTAL_NOTIFICATION_VALUE
@ -239,6 +242,16 @@ var CaptivePortalWatcher = {
this._cancelDelayedCaptivePortal();
this._removeNotification();
let durationInSeconds = Math.round(
(Date.now() - this._bannerDisplayTime) / 1000
);
Services.telemetry.keyedScalarAdd(
"networking.captive_portal_banner_display_time",
aSuccess ? "success" : "abort",
durationInSeconds
);
if (!this._captivePortalTab) {
return;
}
@ -301,6 +314,12 @@ var CaptivePortalWatcher = {
return;
}
Services.telemetry.scalarAdd(
"networking.captive_portal_banner_displayed",
1
);
this._bannerDisplayTime = Date.now();
let buttons = [
{
label: this._browserBundle.GetStringFromName(
@ -320,6 +339,18 @@ var CaptivePortalWatcher = {
);
let closeHandler = aEventName => {
if (aEventName == "dismissed") {
let durationInSeconds = Math.round(
(Date.now() - this._bannerDisplayTime) / 1000
);
Services.telemetry.keyedScalarAdd(
"networking.captive_portal_banner_display_time",
"dismiss",
durationInSeconds
);
}
if (aEventName != "removed") {
return;
}

View File

@ -6616,6 +6616,45 @@ networking:
- 'main'
- 'socket'
captive_portal_banner_displayed:
bug_numbers:
- 1868145
description: >
Number of times the captive portal banner was displayed in this session.
expires: never
release_channel_collection: opt-out
keyed: false
kind: uint
notification_emails:
- necko@mozilla.com
products:
- 'firefox'
record_in_processes:
- 'all'
captive_portal_banner_display_time:
bug_numbers:
- 1868145
description: >
Number of seconds the captive portal banner was displayed for, keyed by close reason:
"success" - the portal login was completed
"abort" - the portal login was aborted (e.g. loss of network)
"dismiss" - the user dismissed the banner
expires: never
release_channel_collection: opt-out
keyed: true
keys:
- 'success'
- 'abort'
- 'dismiss'
kind: uint
notification_emails:
- necko@mozilla.com
products:
- 'firefox'
record_in_processes:
- 'all'
http3_enabled:
bug_numbers:
- 1652104