fenix icon indicating copy to clipboard operation
fenix copied to clipboard

Add telemetry probe for startup time

Open mcomella opened this issue 6 years ago • 5 comments

We should ensure this probe matches how we measure startup time in CI testing, if possible.


We repurposed https://github.com/mozilla-mobile/fenix/issues/8803 so this probe is to revisit the telemetry probe for startup. Now that we better know how to write telemetry, we probably want to do the minimal thing here rather than the large number of steps mentioned below.

Why/User Benefit/User Problem

Startup time is an oft cited reason for friction and churn. We need to understand how long it takes Fenix to startup for our users so that we can prioritize work to address regressions and outliers that result in decreased engagement or churn. Local and CI-based testing provides an incomplete picture of how Fenix performs at startup.

Impact

Improved understanding of how Fenix performs on startup for our users.

Acceptance Criteria (how do I know when I’m done?)

We should make a best-effort to incrementally instrument as much of startup as possible - until we hit diminishing returns - because it's impossible to do it all. Unfortunately, it will be difficult to define what this looks like in advance so take this as a guiding principle. Msg mcomella if this does not make sense.

Some incremental steps we should try to implement for GA:

  • ~~Add a metric that tracks the start time of GV~~ I believe this is already available in Gecko telemetry
  • Add a metric that tracks the duration of FenixApplication.onCreate (this may or may not be helpful but we want to add it to see if it is in practice)
  • Add a metric that tracks FenixApplication.onCreate until first frame drawn
  • Distinguish between first run and other cold starts (don't let this impact performance!)
  • (is this reasonable?) Distinguish between which page was shown, i.e. which startup path was used
  • Time from first frame drawn to reportFullyDrawn? Essentially, capture loading top sites & open tabs because this is dependent on content quantity

Some incremental steps we probably can't implement by GA but we should verify:

  • Add a probe that tracks FenixApplication.onCreate until visual completeness
  • Add warm/hot start times, distinguish from cold start
  • Distinguish between cold starts after upgrading and other cold starts

Here is ecsmyth's ideal startup time probe that inspired these incremental steps:

Glean telemetry probe landed in Fenix release that measures time, as closely as is practical, from when user initiates startup until the app is started and the initial screen is visually complete. The probe should differentiate between hot, cold, and warm startup scenarios and account for differences in the first page rendered (e.g., how desktop measures first paint and first paint of about:home)

┆Issue is synchronized with this Jira Task

mcomella avatar Apr 20 '20 22:04 mcomella

TLDR from a conversation with Glean:

It is okay for now to report the launch time as an event extra key (type safety from Fenix side). There is some work done on glean to have type safety for extra_keys. Once that is finished, we can implement type safety for this metric (given we don't change metric or keys name) without disrupting data flow. There is also a struct metric type (not implemented yet) that could be a good alternative for this. However, there will be data disruption if we change the metric type in the future

sraturi avatar Aug 28 '20 18:08 sraturi

Merged with https://github.com/mozilla-mobile/fenix/pull/15605

mcomella avatar Oct 13 '20 19:10 mcomella

QA: we have a telemetry metric called events.app_opened_all_startup. It generally gets queued when the app is closed but will sometimes occur just after. In this issue, we added an extra, first_frame_pre_draw_nanos, which is roughly the time, in nanoseconds, from the app opening until the first frame is drawn. Please validate:

  • the numbers seem reasonable based on the start-up type (i.e. the values in the other extras)
  • the documentation for this extra makes sense & is usable by data scientists, engineers, product managers, etc.

mcomella avatar Oct 13 '20 22:10 mcomella

Hi @mcomella , I've just checked this matter on the latest Nightly Build 201020 using a Google Pixel 3a (Android 11)

• Open Fenix from the app icon displaying the onboarding screen - Ping 0d1d63eb-9ac8-46f9-be3f-d05ec1a61dc7 ❄️Cold startup

"events": [
        {
          "category": "events",
          "extra": {
            "first_frame_pre_draw_nanos": "3174963552",
            "has_saved_instance_state": "false",
            "source": "UNKNOWN",
            "type": "COLD"
          },
          "name": "app_opened_all_startup",
          "timestamp": 0
        }

• Open Fenix from the app icon and dismiss dismiss the onboarding screen - Ping f08dface-e2ea-4375-ae0c-02d488c1aa94 🔥 Hot startup

      "events": [
        {
          "category": "events",
          "extra": {
            "first_frame_pre_draw_nanos": "24094012",
            "source": "APP_ICON",
            "type": "HOT"
          },
          "name": "app_opened_all_startup",
          "timestamp": 0
        }

• Open Fenix from the app icon displaying the home screen - Ping 330f1e3b-6e13-42ab-8027-573cabbcf2a8

🔥 Hot startup

"events": [
        {
          "category": "events",
          "extra": {
            "first_frame_pre_draw_nanos": "27499743",
            "source": "APP_ICON",
            "type": "HOT"
          },
          "name": "app_opened_all_startup",
          "timestamp": 0
        }

• Open Fenix from the app icon displaying a page view (Google.com) - Ping 51a784db-6a4f-407d-bc3f-3358f99b74a9 🔥 Hot startup

"events": [
        {
          "category": "events",
          "extra": {
            "first_frame_pre_draw_nanos": "31849639",
            "source": "APP_ICON",
            "type": "HOT"
          },
          "name": "app_opened_all_startup",
          "timestamp": 0
        }

• While Fenix is in background - > Open a custom tab - Ping a314285e-345a-4758-bd6d-821d2a430d28 🔥 Hot startup

"events": [
        {
          "category": "events",
          "extra": {
            "first_frame_pre_draw_nanos": "30727086",
            "source": "APP_ICON",
            "type": "HOT"
          },
          "name": "app_opened_all_startup",
          "timestamp": 0
        },

• Force close Fenix -> Resume a previously opened custom tab - Ping 7424ba5a-b6ef-4d37-a9a6-e7f612807f53 ☀️ Warm startup

"events": [
        {
          "category": "events",
          "extra": {
            "first_frame_pre_draw_nanos": "102212249",
            "has_saved_instance_state": "false",
            "source": "CUSTOM_TAB",
            "type": "WARM"
          },
          "name": "app_opened_all_startup",
          "timestamp": 0
        

• While Fenix is in background -> Open a custom tab -> Open the custom tab in Fenix (using the "Open in Firefox Nightly" from the custom tabs overlay ) - Ping fb96ddfc-bdf5-476b-9a8a-1e010fbd462c ☀️ Warm startup

"events": [
        {
          "category": "events",
          "extra": {
            "first_frame_pre_draw_nanos": "104099125",
            "has_saved_instance_state": "false",
            "source": "APP_ICON",
            "type": "WARM"
          },
          "name": "app_opened_all_startup",
          "timestamp": 0
        }

• Open a custom tab -> Force close Fenix -> Open Fenix from the App icon - Ping bbc72c47-b068-4369-a977-3d13b0e1a993 ☀️ Warm startup

"events": [
        {
          "category": "events",
          "extra": {
            "first_frame_pre_draw_nanos": "89704020",
            "has_saved_instance_state": "false",
            "source": "APP_ICON",
            "type": "WARM"
          },
          "name": "app_opened_all_startup",
          "timestamp": 0
        }

• Force Stop Fenix and re-open it - Ping e82dc6e8-72b3-43ea-a43f-64f0e0e04b64 ❄️Cold startup

"events": [
        {
          "category": "events",
          "extra": {
            "first_frame_pre_draw_nanos": "597429346",
            "has_saved_instance_state": "false",
            "source": "UNKNOWN",
            "type": "COLD"
          },
          "name": "app_opened_all_startup",
          "timestamp": 0
        }
Startup type "first_frame_pre_draw_nanos" seconds
❄️Cold startup 3174963552 3.17
❄️Cold startup 597429346 0.60
☀️ Warm startup 102212249 0.10
☀️ Warm startup 104099125 0.10
☀️ Warm startup 89704020 0.08
🔥 Hot startup 24094012 0.02
🔥 Hot startup 27499743 0.02
🔥 Hot startup 31849639 0.03
🔥 Hot startup 30727086 0.03

Logcat Glean dashboard

✔️ The values per each start-up type seem to be similar. ❓ However, I'm not sure why for the first cold start 3.17 seconds is recorded, it didn't really take that much.

I launch the app using this cmd: adb shell am start -n org.mozilla.fenix/mozilla.telemetry.glean.debug.GleanDebugActivity --ez logPings true --es tagPings aj-test-01 (The tagPings atribute can be changed) and afterwards the "app_received_intent" event type ping is generated.

{
"category": "events",
"extra": {
"source": "UNKNOWN"
},
"name": "app_received_intent"

I put Fenix in background => resume it (Onboarding screen is displayed) => put it again in background. Only after this, the first "name": "app_opened_all_startup" event type ping is generated.

Please review and share your thoughts. ☺️
I'll remove the QA needed label until further notice.

AndiAJ avatar Oct 20 '20 13:10 AndiAJ

See: https://github.com/mozilla-mobile/fenix/issues/17373 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 18 '21 14:04 stale[bot]