From aa3846212c1a5e515f831aa67ad59733aa4fc6fa Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Mon, 12 Apr 2021 15:41:46 -0700 Subject: [PATCH] For #18836: add metric perf.startup.startup_type. --- app/metrics.yaml | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ docs/metrics.md | 1 + 2 files changed, 76 insertions(+) diff --git a/app/metrics.yaml b/app/metrics.yaml index 26e285963..158fcf938 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -4492,6 +4492,81 @@ perf.startup: - perf-android-fe@mozilla.com - mcomella@mozilla.com expires: "2021-08-11" + startup_type: + type: labeled_counter + description: | + Indicates how the browser was started. The label is divided into two + variables. `state` is how cached the browser is when started. `path` is + what code path we are expected to take. Together, they create a combined + label: `state_path`. For brevity, the specific states are documented in + the [Fenix perf + glossary](https://wiki.mozilla.org/index.php?title=Performance/Fenix/Glossary). +

+ This implementation is intended to be simple, not comprehensive. We list + the implications below. + +

+ These ways of opening the app undesirably adds events to our primary + buckets (non-`unknown` cases): +
- App switcher cold/warm: `cold/warm_` + duplicates path from + previous launch +
- Home screen shortcuts: `*_view` +
- An Intent is sent internally that's uses `ACTION_MAIN` or + `ACTION_VIEW` could be: `*_main/view` (unknown if this ever happens) +
- A command-line launch uses `ACTION_MAIN` or `ACTION_VIEW` could be: + `*_main/view` + +

+ These ways of opening the app undesirably do not add their events to our + primary buckets: +
- Close and reopen the app very quickly: no event is recorded. + +

+ These ways of opening the app don't affect our primary buckets: +
- App switcher hot: `hot_unknown` +
- PWA (all states): `unknown_unknown` +
- Custom tab: `unknown_view` +
- Cold start where a service or other non-activity starts the process + (not manually tested) - this seems to happen if you have the homescreen + widget: `unknown_*` +
- Another activity is drawn before HomeActivity (e.g. widget voice + search): `unknown_*` +
- Widget text search: `*_unknown` + +

+ In addition to the events above, the `unknown` state may be chosen when we + were unable to determine a cause due to implementation details or the API + was used incorrectly. We may be able to record the events listed above + into different buckets but we kept the implementation simple for now. +

+ N.B.: for implementation simplicity, we duplicate the logic in app that + determines `path` so it's not perfectly accurate. In one way, we record we + is intended to happen rather than what actually happened (e.g. the user + may click a link so we record VIEW but the app does a MAIN by going to the + homescreen because the link was invalid). + labels: + - cold_main + - cold_view + - cold_unknown + - warm_main + - warm_view + - warm_unknown + - hot_main + - hot_view + - hot_unknown + - unknown_main + - unknown_view + - unknown_unknown + bugs: + - https://github.com/mozilla-mobile/fenix/issues/18836 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/19028 + data_sensitivity: + - interaction + notification_emails: + - perf-android-fe@mozilla.com + - mcomella@mozilla.com + expires: "2021-10-09" perf.awesomebar: history_suggestions: diff --git a/docs/metrics.md b/docs/metrics.md index 0b80657d2..211d807bb 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -366,6 +366,7 @@ In addition to those built-in metrics, the following metrics are added to the pi | perf.startup.home_activity_on_start |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |The duration of `HomeActivity.onStart`. This may encapsulate `HomeFragment` or `BrowserFragment` creation, depending on the code path, so we expect this to take varying amounts of time. As such, this probe may not be easy to interpret directly but we believe collecting it may give us more information about different patterns we might see in performance data. |[mozilla-mobile/fenix#18558](https://github.com/mozilla-mobile/fenix/pull/18558#issue-596791848)||2021-08-11 |1 | | perf.startup.home_fragment_on_create_view |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |The duration of `HomeFragment.onCreateView`. |[mozilla-mobile/fenix#18558](https://github.com/mozilla-mobile/fenix/pull/18558#issue-596791848)||2021-08-11 |1 | | perf.startup.home_fragment_on_view_created |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |The duration of `HomeFragment.onViewCreated`. |[mozilla-mobile/fenix#18558](https://github.com/mozilla-mobile/fenix/pull/18558#issue-596791848)||2021-08-11 |1 | +| perf.startup.startup_type |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Indicates how the browser was started. The label is divided into two variables. `state` is how cached the browser is when started. `path` is what code path we are expected to take. Together, they create a combined label: `state_path`. For brevity, the specific states are documented in the [Fenix perf glossary](https://wiki.mozilla.org/index.php?title=Performance/Fenix/Glossary).

This implementation is intended to be simple, not comprehensive. We list the implications below.

These ways of opening the app undesirably adds events to our primary buckets (non-`unknown` cases):
- App switcher cold/warm: `cold/warm_` + duplicates path from previous launch
- Home screen shortcuts: `*_view`
- An Intent is sent internally that's uses `ACTION_MAIN` or `ACTION_VIEW` could be: `*_main/view` (unknown if this ever happens)
- A command-line launch uses `ACTION_MAIN` or `ACTION_VIEW` could be: `*_main/view`

These ways of opening the app undesirably do not add their events to our primary buckets:
- Close and reopen the app very quickly: no event is recorded.

These ways of opening the app don't affect our primary buckets:
- App switcher hot: `hot_unknown`
- PWA (all states): `unknown_unknown`
- Custom tab: `unknown_view`
- Cold start where a service or other non-activity starts the process (not manually tested) - this seems to happen if you have the homescreen widget: `unknown_*`
- Another activity is drawn before HomeActivity (e.g. widget voice search): `unknown_*`
- Widget text search: `*_unknown`

In addition to the events above, the `unknown` state may be chosen when we were unable to determine a cause due to implementation details or the API was used incorrectly. We may be able to record the events listed above into different buckets but we kept the implementation simple for now.

N.B.: for implementation simplicity, we duplicate the logic in app that determines `path` so it's not perfectly accurate. In one way, we record we is intended to happen rather than what actually happened (e.g. the user may click a link so we record VIEW but the app does a MAIN by going to the homescreen because the link was invalid). |[mozilla-mobile/fenix#19028](https://github.com/mozilla-mobile/fenix/pull/19028)||2021-10-09 |2 | | 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: "" |[mozilla-mobile/fenix#11211](https://github.com/mozilla-mobile/fenix/pull/11211), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 | | 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 |[mozilla-mobile/fenix#11211](https://github.com/mozilla-mobile/fenix/pull/11211), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 | | 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 |[mozilla-mobile/fenix#11446](https://github.com/mozilla-mobile/fenix/pull/11446), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |