1
0
Fork 0

For #11118: Add missing telemetry

master
Sawyer Blatz 2020-06-10 12:40:36 -07:00
parent 68017e5a00
commit d1cd877374
3 changed files with 110 additions and 50 deletions

View File

@ -728,6 +728,34 @@ preferences:
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
open_links_in_app:
type: string_list
description: >
Whether or not the user has the open links in apps feature enabled.
default: false
send_in_pings:
- metrics
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11118
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11446
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
theme:
type: string_list
description: >
The theme the user has enabled. "light," "dark," "system," or "battery"
default: "system" for API 28+, else "light"
send_in_pings:
- metrics
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11118
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11446
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
search.default_engine:
code:

View File

@ -590,56 +590,7 @@ class GleanMetricsService(private val context: Context) : MetricsService {
}
internal fun setStartupMetrics() {
// We purposefully make all of our preferences the string_list format to make data analysis
// simpler. While it makes things like booleans a bit more complicated, it means all our
// preferences can be analyzed with the same dashboard and compared.
Preferences.apply {
showSearchSuggestions.set(context.settings().shouldShowSearchSuggestions.toStringList())
remoteDebugging.set(context.settings().isRemoteDebuggingEnabled.toStringList())
telemetry.set(context.settings().isTelemetryEnabled.toStringList())
searchBookmarks.set(context.settings().shouldShowBookmarkSuggestions.toStringList())
showClipboardSuggestions.set(context.settings().shouldShowClipboardSuggestions.toStringList())
showSearchShortcuts.set(context.settings().shouldShowSearchShortcuts.toStringList())
openLinksInAPrivateTab.set(context.settings().openLinksInAPrivateTab.toStringList())
searchSuggestionsPrivate.set(context.settings().shouldShowSearchSuggestionsInPrivate.toStringList())
val isLoggedIn =
context.components.backgroundServices.accountManager.accountProfile() != null
sync.set(isLoggedIn.toStringList())
val syncedItems = SyncEnginesStorage(context).getStatus().entries.filter {
it.value
}.map { it.key.nativeName }
syncItems.set(syncedItems)
val etpSelection =
if (!context.settings().shouldUseTrackingProtection) {
""
} else if (context.settings().useStandardTrackingProtection) {
"standard"
} else if (context.settings().useStrictTrackingProtection) {
"strict"
} else if (context.settings().useCustomTrackingProtection) {
"custom"
} else {
""
}
trackingProtection.set(listOf(etpSelection))
val accessibilitySelection = mutableListOf<String>()
if (context.settings().switchServiceIsEnabled) { accessibilitySelection.add("switch") }
if (context.settings().touchExplorationIsEnabled) {
accessibilitySelection.add("touch exploration")
}
accessibilityServices.set(accessibilitySelection.toList())
}
setPreferenceMetrics()
Metrics.apply {
defaultBrowser.set(BrowsersCache.all(context).isDefaultBrowser)
MozillaProductDetector.getMozillaBrowserDefault(context)?.also {
@ -685,6 +636,85 @@ class GleanMetricsService(private val context: Context) : MetricsService {
installationPing.checkAndSend()
}
private fun setPreferenceMetrics() {
// We purposefully make all of our preferences the string_list format to make data analysis
// simpler. While it makes things like booleans a bit more complicated, it means all our
// preferences can be analyzed with the same dashboard and compared.
Preferences.apply {
showSearchSuggestions.set(context.settings().shouldShowSearchSuggestions.toStringList())
remoteDebugging.set(context.settings().isRemoteDebuggingEnabled.toStringList())
telemetry.set(context.settings().isTelemetryEnabled.toStringList())
searchBookmarks.set(context.settings().shouldShowBookmarkSuggestions.toStringList())
showClipboardSuggestions.set(context.settings().shouldShowClipboardSuggestions.toStringList())
showSearchShortcuts.set(context.settings().shouldShowSearchShortcuts.toStringList())
openLinksInAPrivateTab.set(context.settings().openLinksInAPrivateTab.toStringList())
searchSuggestionsPrivate.set(context.settings().shouldShowSearchSuggestionsInPrivate.toStringList())
showVoiceSearch.set(context.settings().shouldShowVoiceSearch.toStringList())
openLinksInApp.set(context.settings().openLinksInExternalApp.toStringList())
val isLoggedIn =
context.components.backgroundServices.accountManager.accountProfile() != null
sync.set(isLoggedIn.toStringList())
val syncedItems = SyncEnginesStorage(context).getStatus().entries.filter {
it.value
}.map { it.key.nativeName }
syncItems.set(syncedItems)
val toolbarPositionSelection =
if (context.settings().shouldUseFixedTopToolbar) {
"fixed_top"
} else if (context.settings().shouldUseBottomToolbar) {
"bottom"
} else {
"top"
}
toolbarPosition.set(listOf(toolbarPositionSelection))
val etpSelection =
if (!context.settings().shouldUseTrackingProtection) {
""
} else if (context.settings().useStandardTrackingProtection) {
"standard"
} else if (context.settings().useStrictTrackingProtection) {
"strict"
} else if (context.settings().useCustomTrackingProtection) {
"custom"
} else {
""
}
trackingProtection.set(listOf(etpSelection))
val accessibilitySelection = mutableListOf<String>()
if (context.settings().switchServiceIsEnabled) { accessibilitySelection.add("switch") }
if (context.settings().touchExplorationIsEnabled) {
accessibilitySelection.add("touch exploration")
}
accessibilityServices.set(accessibilitySelection.toList())
val themeSelection =
if (context.settings().shouldUseLightTheme) {
"light"
} else if (context.settings().shouldUseDarkTheme) {
"dark"
} else if (context.settings().shouldFollowDeviceTheme) {
"system"
} else if (context.settings().shouldUseAutoBatteryTheme) {
"battery"
} else {
""
}
theme.set(listOf(themeSelection))
}
}
override fun stop() {
Glean.setUploadEnabled(false)
}

View File

@ -251,6 +251,7 @@ The following metrics are added to the ping:
| perf.awesomebar.synced_tabs_suggestions |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |Duration of a synced tabs awesomebar suggestion query. |[1](https://github.com/mozilla-mobile/fenix/pull/10276#pullrequestreview-411101979)||2020-09-15 |
| preferences.accessibility_services |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |Whether or not the user has touch exploration or switch services enabled. These are built into the Android OS, not Fenix prefs. default: "" |[1](https://github.com/mozilla-mobile/fenix/pull/11211)||2020-09-01 |
| preferences.open_links_in_a_private_tab |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |Whether or not the user has enabled open links in a private tab. default: false |[1](https://github.com/mozilla-mobile/fenix/pull/11211)||2020-09-01 |
| preferences.open_links_in_app |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |Whether or not the user has the open links in apps feature enabled. default: false |[1](https://github.com/mozilla-mobile/fenix/pull/11446)||2020-09-01 |
| preferences.remote_debugging |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |Whether or not the user has remote debugging enabled default: false |[1](https://github.com/mozilla-mobile/fenix/pull/11211)||2020-09-01 |
| preferences.search_bookmarks |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |Whether or not the user has enabled bookmark search suggestions default: true |[1](https://github.com/mozilla-mobile/fenix/pull/11211)||2020-09-01 |
| preferences.search_browsing_history |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |Whether or not the user has enabled browsing history suggestions. default: true |[1](https://github.com/mozilla-mobile/fenix/pull/11211)||2020-09-01 |
@ -262,6 +263,7 @@ The following metrics are added to the ping:
| preferences.sync |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |Whether or not the user is signed into FxA default: false |[1](https://github.com/mozilla-mobile/fenix/pull/11211)||2020-09-01 |
| preferences.sync_items |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |The list of items the user has chosen to sync with FxA. default: "" if the user is signed out. Otherwise defaults to whatever is set in their FxA account. New accounts set: [bookmarks, history, passwords, tabs] |[1](https://github.com/mozilla-mobile/fenix/pull/11211)||2020-09-01 |
| preferences.telemetry |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |Whether or not the user has telemetry enabled. Note we should never receive a "false" value for this since telemetry would not send in that case. default: true |[1](https://github.com/mozilla-mobile/fenix/pull/11211)||2020-09-01 |
| preferences.theme |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |The theme the user has enabled. "light," "dark," "system," or "battery" default: "system" for API 28+, else "light" |[1](https://github.com/mozilla-mobile/fenix/pull/11446)||2020-09-01 |
| preferences.toolbar_position |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |The position of the toolbar default: bottom (defaults to top if the user has accessibility services) |[1](https://github.com/mozilla-mobile/fenix/pull/11211)||2020-09-01 |
| preferences.tracking_protection |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |What type of enhanced tracking protection the user has enabled. "standard," "strict," "custom," or "" (if disabled) default: "standard" |[1](https://github.com/mozilla-mobile/fenix/pull/11211)||2020-09-01 |
| search.default_engine.code |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |If the search engine is pre-loaded with Fenix this value will be the search engine identifier. If it's a custom search engine (defined: https://github.com/mozilla-mobile/fenix/issues/1607) the value will be "custom" |[1](https://github.com/mozilla-mobile/fenix/pull/1606), [2](https://github.com/mozilla-mobile/fenix/pull/5216)||2020-09-01 |