1
0
Fork 0

Perf telemetry for awesomebar suggestion provider durations

See mozilla-mobile/android-components#6802 for details; requires that PR.
master
Grisha Kruglov 2020-05-13 14:10:23 -07:00 committed by Grisha Kruglov
parent 94fb5a7723
commit d37529e416
3 changed files with 142 additions and 0 deletions

View File

@ -2179,3 +2179,110 @@ startup.timeline:
- perf-android-fe@mozilla.com
- mcomella@mozilla.com
expires: "2020-07-15"
perf.awesomebar:
history_suggestions:
send_in_pings:
- metrics
type: timing_distribution
time_unit: millisecond
description: >
Duration of a history awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/10276#pullrequestreview-411101979
notification_emails:
- fenix-core@mozilla.com
- gkruglov@mozilla.com
expires: "2020-09-15"
bookmark_suggestions:
send_in_pings:
- metrics
type: timing_distribution
time_unit: millisecond
description: >
Duration of a bookmarks awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/10276#pullrequestreview-411101979
notification_emails:
- fenix-core@mozilla.com
- gkruglov@mozilla.com
expires: "2020-09-15"
search_engine_suggestions:
send_in_pings:
- metrics
type: timing_distribution
time_unit: millisecond
description: >
Duration of a search engine awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/10276#pullrequestreview-411101979
notification_emails:
- fenix-core@mozilla.com
- gkruglov@mozilla.com
expires: "2020-09-15"
session_suggestions:
send_in_pings:
- metrics
type: timing_distribution
time_unit: millisecond
description: >
Duration of a session awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/10276#pullrequestreview-411101979
notification_emails:
- fenix-core@mozilla.com
- gkruglov@mozilla.com
expires: "2020-09-15"
synced_tabs_suggestions:
send_in_pings:
- metrics
type: timing_distribution
time_unit: millisecond
description: >
Duration of a synced tabs awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/10276#pullrequestreview-411101979
notification_emails:
- fenix-core@mozilla.com
- gkruglov@mozilla.com
expires: "2020-09-15"
clipboard_suggestions:
send_in_pings:
- metrics
type: timing_distribution
time_unit: millisecond
description: >
Duration of a clipboard awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/10276#pullrequestreview-411101979
notification_emails:
- fenix-core@mozilla.com
- gkruglov@mozilla.com
expires: "2020-09-15"
shortcuts_suggestions:
send_in_pings:
- metrics
type: timing_distribution
time_unit: millisecond
description: >
Duration of a shortcuts awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/10276#pullrequestreview-411101979
notification_emails:
- fenix-core@mozilla.com
- gkruglov@mozilla.com
expires: "2020-09-15"

View File

@ -5,10 +5,17 @@
package org.mozilla.fenix.components.metrics
import android.content.Context
import mozilla.components.browser.awesomebar.facts.BrowserAwesomeBarFacts
import mozilla.components.browser.errorpages.ErrorType
import mozilla.components.browser.menu.facts.BrowserMenuFacts
import mozilla.components.browser.search.SearchEngine
import mozilla.components.browser.toolbar.facts.ToolbarFacts
import mozilla.components.concept.awesomebar.AwesomeBar
import mozilla.components.feature.awesomebar.provider.BookmarksStorageSuggestionProvider
import mozilla.components.feature.awesomebar.provider.ClipboardSuggestionProvider
import mozilla.components.feature.awesomebar.provider.SearchSuggestionProvider
import mozilla.components.feature.awesomebar.provider.SessionSuggestionProvider
import mozilla.components.feature.awesomebar.provider.HistoryStorageSuggestionProvider
import mozilla.components.feature.contextmenu.facts.ContextMenuFacts
import mozilla.components.feature.customtabs.CustomTabsFacts
import mozilla.components.feature.downloads.facts.DownloadsFacts
@ -30,11 +37,13 @@ import org.mozilla.fenix.GleanMetrics.CrashReporter
import org.mozilla.fenix.GleanMetrics.ErrorPage
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.Logins
import org.mozilla.fenix.GleanMetrics.PerfAwesomebar
import org.mozilla.fenix.GleanMetrics.SearchShortcuts
import org.mozilla.fenix.GleanMetrics.Tip
import org.mozilla.fenix.GleanMetrics.ToolbarSettings
import org.mozilla.fenix.GleanMetrics.TrackingProtection
import org.mozilla.fenix.R
import org.mozilla.fenix.search.awesomebar.ShortcutsSuggestionProvider
import java.util.Locale
sealed class Event {
@ -471,6 +480,25 @@ private fun Fact.toEvent(): Event? = when (Pair(component, item)) {
null
}
Component.BROWSER_AWESOMEBAR to BrowserAwesomeBarFacts.Items.PROVIDER_DURATION -> {
metadata?.get(BrowserAwesomeBarFacts.MetadataKeys.DURATION_PAIR)?.let { providerTiming ->
require(providerTiming is Pair<*, *>) { "Expected providerTiming to be a Pair" }
when (val provider = providerTiming.first as AwesomeBar.SuggestionProvider) {
is HistoryStorageSuggestionProvider -> PerfAwesomebar.historySuggestions
is BookmarksStorageSuggestionProvider -> PerfAwesomebar.bookmarkSuggestions
is SessionSuggestionProvider -> PerfAwesomebar.sessionSuggestions
is SearchSuggestionProvider -> PerfAwesomebar.searchEngineSuggestions
is ClipboardSuggestionProvider -> PerfAwesomebar.clipboardSuggestions
is ShortcutsSuggestionProvider -> PerfAwesomebar.shortcutsSuggestions
// NB: add PerfAwesomebar.syncedTabsSuggestions once we're using SyncedTabsSuggestionProvider
else -> {
Logger("Metrics").error("Unknown suggestion provider: $provider")
null
}
}?.accumulateSamples(longArrayOf(providerTiming.second as Long))
}
null
}
else -> null
}

File diff suppressed because one or more lines are too long