Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Perf telemetry for awesomebar suggestion provider durations
Browse files Browse the repository at this point in the history
See mozilla-mobile/android-components#6802 for details; requires that PR.
  • Loading branch information
Grisha Kruglov committed Apr 29, 2020
1 parent 996daba commit defcd0b
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 0 deletions.
107 changes: 107 additions & 0 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2134,3 +2134,110 @@ startup.timeline:
- [email protected]
- [email protected]
expires: "2020-07-15"

perf.awesomebar:
history_suggestions:
send_in_pings:
- metrics
type: timespan
time_unit: millisecond
description: >
Duration of a history awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- TODO
notification_emails:
- [email protected]
- [email protected]
expires: "2020-09-15"
bookmark_suggestions:
send_in_pings:
- metrics
type: timespan
time_unit: millisecond
description: >
Duration of a bookmarks awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- TODO
notification_emails:
- [email protected]
- [email protected]
expires: "2020-09-15"
search_egnine_suggestions:
send_in_pings:
- metrics
type: timespan
time_unit: millisecond
description: >
Duration of a search engine awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- TODO
notification_emails:
- [email protected]
- [email protected]
expires: "2020-09-15"
session_suggestions:
send_in_pings:
- metrics
type: timespan
time_unit: millisecond
description: >
Duration of a session awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- TODO
notification_emails:
- [email protected]
- [email protected]
expires: "2020-09-15"
synced_tabs_suggestions:
send_in_pings:
- metrics
type: timespan
time_unit: millisecond
description: >
Duration of a synced tabs awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- TODO
notification_emails:
- [email protected]
- [email protected]
expires: "2020-09-15"
clipboard_suggestions:
send_in_pings:
- metrics
type: timespan
time_unit: millisecond
description: >
Duration of a clipboard awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- TODO
notification_emails:
- [email protected]
- [email protected]
expires: "2020-09-15"
shortcuts_suggestions:
send_in_pings:
- metrics
type: timespan
time_unit: millisecond
description: >
Duration of a shortcuts awesomebar suggestion query.
bugs:
- https://github.com/mozilla-mobile/android-components/issues/4992
data_reviews:
- TODO
notification_emails:
- [email protected]
- [email protected]
expires: "2020-09-15"
28 changes: 28 additions & 0 deletions app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,11 +38,13 @@ import org.mozilla.fenix.GleanMetrics.ErrorPage
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.Library
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 {
Expand Down Expand Up @@ -474,6 +483,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.searchEgnineSuggestions
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
}
}?.setRawNanos(providerTiming.second as Long)
}
null
}
else -> null
}

Expand Down
7 changes: 7 additions & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ The following metrics are added to the ping:
| metrics.search_count |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |The labels for this counter are `<search-engine-name>.<source>`. If the search engine is bundled with Fenix `search-engine-name` will be the name of the search engine. If it's a custom search engine (defined: https://github.com/mozilla-mobile/fenix/issues/1607) the value will be `custom`. `source` will be: `action`, `suggestion`, `widget` or `shortcut` (depending on the source from which the search started). Also added the `other` option for the source but it should never enter on this case. |[1](https://github.com/mozilla-mobile/fenix/pull/1677), [2](https://github.com/mozilla-mobile/fenix/pull/5216), [3](https://github.com/mozilla-mobile/fenix/pull/7310)||2020-09-01 |
| metrics.toolbar_position |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |A string that indicates the new position of the toolbar TOP or BOTTOM |[1](https://github.com/mozilla-mobile/fenix/pull/6608)||2020-09-01 |
| metrics.top_sites_count |[counter](https://mozilla.github.io/glean/book/user/metrics/counter.html) |A counter that indicates how many top sites a user has |[1](https://github.com/mozilla-mobile/fenix/pull/9556)||2020-09-01 |
| perf.awesomebar.bookmark_suggestions |[timespan](https://mozilla.github.io/glean/book/user/metrics/timespan.html) |Duration of a bookmarks awesomebar suggestion query. |[1](TODO)||2020-09-15 |
| perf.awesomebar.clipboard_suggestions |[timespan](https://mozilla.github.io/glean/book/user/metrics/timespan.html) |Duration of a clipboard awesomebar suggestion query. |[1](TODO)||2020-09-15 |
| perf.awesomebar.history_suggestions |[timespan](https://mozilla.github.io/glean/book/user/metrics/timespan.html) |Duration of a history awesomebar suggestion query. |[1](TODO)||2020-09-15 |
| perf.awesomebar.search_egnine_suggestions |[timespan](https://mozilla.github.io/glean/book/user/metrics/timespan.html) |Duration of a search engine awesomebar suggestion query. |[1](TODO)||2020-09-15 |
| perf.awesomebar.session_suggestions |[timespan](https://mozilla.github.io/glean/book/user/metrics/timespan.html) |Duration of a session awesomebar suggestion query. |[1](TODO)||2020-09-15 |
| perf.awesomebar.shortcuts_suggestions |[timespan](https://mozilla.github.io/glean/book/user/metrics/timespan.html) |Duration of a shortcuts awesomebar suggestion query. |[1](TODO)||2020-09-15 |
| perf.awesomebar.synced_tabs_suggestions |[timespan](https://mozilla.github.io/glean/book/user/metrics/timespan.html) |Duration of a synced tabs awesomebar suggestion query. |[1](TODO)||2020-09-15 |
| 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 |
| search.default_engine.name |[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 name. 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 |
| search.default_engine.submission_url |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |If the search engine is pre-loaded with Fenix this value will be he base URL we use to build the search query for the search engine. For example: https://mysearchengine.com/?query=%s. 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 |
Expand Down

3 comments on commit defcd0b

@firefoxci-taskcluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

Bad credentials

@firefoxci-taskcluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

Bad credentials

@firefoxci-taskcluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

Bad credentials

Please sign in to comment.