Skip to content

Add API to track screens #2981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
markushi opened this issue Oct 11, 2023 · 3 comments
Open

Add API to track screens #2981

markushi opened this issue Oct 11, 2023 · 3 comments
Assignees
Labels
Android SDK Feature Issue type

Comments

@markushi
Copy link
Member

markushi commented Oct 11, 2023

For the insights modules we want to provide metrics on a screen level. As of now, we do not track screens per se, but have automatic (idle) activity transactions which offers similar functionality.

In order to no rely too much on future performance features(like spans without transactions) we could the following:

  • For every screen, create a long running transaction
  • Add user interactions as spans
  • Add slow/frozen frames as spans
  • Add TTID/TTFD metrics to the screen txn

As a default implementation we can have an Activity based screen provider, as this would work for any Android app.

Implementation Details

For every screen, create a long running transaction

It makes sense to stop the transaction as some point, so whenever the screen is closed or a timeout (30s?) is reached the txn gets finished.

Add user interactions as spans

Right now it would create it's own idle txn, can be turned into a span instead. Should be simply enough.

Add slow/frozen frames as spans

Should be similar to what we have right now

Add TTID/TTFD metrics to the screen txn

This is probably the trickiest one, as the start of the TTID is the moment where the new screen isn't active yet.
If an app is activity based it works like this

  1. Activity.onPause() is called for the old screen, --> this is the starting point of the TTID/TTFD measurement
  2. New Activity is created and launched
  3. New Activity.onResume is called
  4. New Activity renders first frame --> end of TTID measurement
@markushi markushi changed the title [Android] Track screen names [Starfish] Add API to track screens Oct 11, 2023
@markushi markushi self-assigned this Oct 11, 2023
@github-project-automation github-project-automation bot moved this to Needs Discussion in [DEPRECATED] Mobile SDKs Oct 11, 2023
@stefanosiano stefanosiano moved this from Needs Discussion to In Progress in [DEPRECATED] Mobile SDKs Oct 18, 2023
@kahest kahest changed the title [Starfish] Add API to track screens Add API to track screens Nov 7, 2023
@markushi
Copy link
Member Author

markushi commented Nov 20, 2023

As agreed in the decision log https://www.notion.so/sentry/Add-screen-name-to-app-context-15093e9f572d4df5a3767d3c36f828e3 we'll focus on this at a later point.

For the first iteration we'll simply provide the current ViewController / Activity, a manual API will be added later on.

@kahest
Copy link
Member

kahest commented Sep 25, 2024

a possible interim solution which can be reused for Screens API is discussed here: #3719

@markushi
Copy link
Member Author

markushi commented Apr 9, 2025

Internal Notion doc about suggested approach and next steps: https://www.notion.so/sentry/Screen-Tracking-for-Android-1b98b10e4b5d8038b8cac3d2812ac09b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android SDK Feature Issue type
Projects
Status: Backlog
Development

No branches or pull requests

4 participants