From 8dd6bffd9580e96694569914e4dd16cf9c75ca95 Mon Sep 17 00:00:00 2001 From: Daosheng Mu Date: Thu, 21 Nov 2019 13:05:27 -0800 Subject: [PATCH] Add telemetry for creating new windows. Fixes #2347 --- app/metrics.yaml | 25 +++++++++++++------ .../telemetry/GleanMetricsService.java | 5 ++++ .../mozilla/vrbrowser/ui/widgets/Windows.java | 5 ++++ docs/metrics.md | 1 + 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/app/metrics.yaml b/app/metrics.yaml index 1c6eb8424..d1083e770 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -25,6 +25,7 @@ distribution: - fxr-telemetry@mozilla.com - dmu@mozilla.com expires: "2020-05-01" + url: domains: type: counter @@ -70,6 +71,7 @@ url: - fxr-telemetry@mozilla.com - dmu@mozilla.com expires: "2020-05-01" + searches: counts: type: labeled_counter @@ -108,7 +110,6 @@ tabs: - fxr-telemetry@mozilla.com - manmartin@mozilla.com expires: "2020-05-01" - activated: type: counter description: > @@ -137,7 +138,6 @@ firefox_account: - fxr-telemetry@mozilla.com - manmartin@mozilla.com expires: "2020-05-01" - sign_in_result: type: event description: > @@ -153,7 +153,6 @@ firefox_account: - fxr-telemetry@mozilla.com - manmartin@mozilla.com expires: "2020-05-01" - sign_out: type: event description: > @@ -166,7 +165,6 @@ firefox_account: - fxr-telemetry@mozilla.com - manmartin@mozilla.com expires: "2020-05-01" - bookmarks_sync_status: type: boolean lifetime: application @@ -180,7 +178,6 @@ firefox_account: - fxr-telemetry@mozilla.com - manmartin@mozilla.com expires: "2020-05-01" - history_sync_status: type: boolean lifetime: application @@ -194,7 +191,6 @@ firefox_account: - fxr-telemetry@mozilla.com - manmartin@mozilla.com expires: "2020-05-01" - tab_sent: type: counter description: > @@ -207,7 +203,6 @@ firefox_account: - fxr-telemetry@mozilla.com - manmartin@mozilla.com expires: "2020-05-01" - received_tab: type: labeled_counter description: > @@ -227,3 +222,19 @@ firefox_account: - fxr-telemetry@mozilla.com - manmartin@mozilla.com expires: "2020-05-01" + +control: + open_new_window: + type: counter + description: > + Counting how many general windows are opened in a session. + send_in_pings: + - session_end + bugs: + - https://github.com/MozillaReality/FirefoxReality/issues/2347 + data_reviews: + - https://github.com/MozillaReality/FirefoxReality/pull/2348#issuecomment-564736919 + notification_emails: + - fxr-telemetry@mozilla.com + - dmu@mozilla.com + expires: "2020-05-01" \ No newline at end of file diff --git a/app/src/common/shared/org/mozilla/vrbrowser/telemetry/GleanMetricsService.java b/app/src/common/shared/org/mozilla/vrbrowser/telemetry/GleanMetricsService.java index 4aebb6e66..8e2a361b1 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/telemetry/GleanMetricsService.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/telemetry/GleanMetricsService.java @@ -12,6 +12,7 @@ import org.mozilla.vrbrowser.GleanMetrics.Pings; import org.mozilla.vrbrowser.GleanMetrics.Searches; import org.mozilla.vrbrowser.GleanMetrics.Url; +import org.mozilla.vrbrowser.GleanMetrics.Control; import org.mozilla.vrbrowser.browser.SettingsStore; import org.mozilla.vrbrowser.search.SearchEngineWrapper; import org.mozilla.vrbrowser.utils.DeviceType; @@ -150,6 +151,10 @@ private static String getDefaultSearchEngineIdentifierForTelemetry() { return SearchEngineWrapper.get(context).getIdentifier(); } + public static void newWindowOpenEvent() { + Control.INSTANCE.getOpenNewWindow().add(); + } + private static void setStartupMetrics() { Distribution.INSTANCE.getChannelName().set(DeviceType.isOculusBuild() ? "oculusvr" : BuildConfig.FLAVOR_platform); } diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java index a3ede2886..6adb69811 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java @@ -249,6 +249,11 @@ public WindowWidget addWindow() { focusWindow(newWindow); updateCurvedMode(true); updateViews(); + + // We are only interested in general windows opened. + if (!isInPrivateMode()) { + GleanMetricsService.newWindowOpenEvent(); + } return newWindow; } diff --git a/docs/metrics.md b/docs/metrics.md index 7bb0a8542..d7138e68d 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -57,6 +57,7 @@ The following metrics are added to the ping: | Name | Type | Description | Data reviews | Extras | Expiration | | --- | --- | --- | --- | --- | --- | +| control.open_new_window |[counter](https://mozilla.github.io/glean/book/user/metrics/counter.html) |Counting how many general windows are opened in a session. |[1](https://github.com/MozillaReality/FirefoxReality/pull/2348#issuecomment-564736919)||2020-05-01 | | distribution.channel_name |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The distribution channel name of this application. We use this field to recognize Firefox Reality is distributed to which channels, such as wavevr, oculusvr, googlevr, etc. |[1](https://github.com/MozillaReality/FirefoxReality/pull/1854#issuecomment-546214568)||2020-05-01 | | tabs.activated |[counter](https://mozilla.github.io/glean/book/user/metrics/counter.html) |Number of tabs activated during a session |[1](https://github.com/MozillaReality/FirefoxReality/pull/2327#issuecomment-559103837)||2020-05-01 | | tabs.opened |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Number of tabs opened during a session |[1](https://github.com/MozillaReality/FirefoxReality/pull/2327#issuecomment-559103837)||2020-05-01 |