Skip to content

Commit

Permalink
Add telemetry for creating new windows. Fixes #2347
Browse files Browse the repository at this point in the history
  • Loading branch information
daoshengmu committed Dec 17, 2019
1 parent 93457a2 commit 8dd6bff
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
25 changes: 18 additions & 7 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ distribution:
- fxr-telemetry@mozilla.com
- dmu@mozilla.com
expires: "2020-05-01"

url:
domains:
type: counter
Expand Down Expand Up @@ -70,6 +71,7 @@ url:
- fxr-telemetry@mozilla.com
- dmu@mozilla.com
expires: "2020-05-01"

searches:
counts:
type: labeled_counter
Expand Down Expand Up @@ -108,7 +110,6 @@ tabs:
- fxr-telemetry@mozilla.com
- manmartin@mozilla.com
expires: "2020-05-01"

activated:
type: counter
description: >
Expand Down Expand Up @@ -137,7 +138,6 @@ firefox_account:
- fxr-telemetry@mozilla.com
- manmartin@mozilla.com
expires: "2020-05-01"

sign_in_result:
type: event
description: >
Expand All @@ -153,7 +153,6 @@ firefox_account:
- fxr-telemetry@mozilla.com
- manmartin@mozilla.com
expires: "2020-05-01"

sign_out:
type: event
description: >
Expand All @@ -166,7 +165,6 @@ firefox_account:
- fxr-telemetry@mozilla.com
- manmartin@mozilla.com
expires: "2020-05-01"

bookmarks_sync_status:
type: boolean
lifetime: application
Expand All @@ -180,7 +178,6 @@ firefox_account:
- fxr-telemetry@mozilla.com
- manmartin@mozilla.com
expires: "2020-05-01"

history_sync_status:
type: boolean
lifetime: application
Expand All @@ -194,7 +191,6 @@ firefox_account:
- fxr-telemetry@mozilla.com
- manmartin@mozilla.com
expires: "2020-05-01"

tab_sent:
type: counter
description: >
Expand All @@ -207,7 +203,6 @@ firefox_account:
- fxr-telemetry@mozilla.com
- manmartin@mozilla.com
expires: "2020-05-01"

received_tab:
type: labeled_counter
description: >
Expand All @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)|<ul><li>context_menu</li><li>tabs_dialog</li><li>bookmarks</li><li>history</li><li>fxa_login</li><li>received</li><li>pre_existing</li><li>browser</li></ul>|2020-05-01 |
Expand Down

0 comments on commit 8dd6bff

Please sign in to comment.