Skip to content
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

Custom Transactions for Screens in Insights.ScreenLoads #3644

Open
thinkocapo opened this issue Aug 16, 2024 · 2 comments
Open

Custom Transactions for Screens in Insights.ScreenLoads #3644

thinkocapo opened this issue Aug 16, 2024 · 2 comments

Comments

@thinkocapo
Copy link

Problem Statement

Hi, customer made custom tranasctions for their Screens (majority of their screens are not Activities, so Auto Instrumentation doesn't help them much)

How can they get these custom transactions to appear in Screen Loads? Need the TTID TTFD too.

Solution Brainstorm

A way to let Custom Transactions to appear in Screen Loads and with their TTID TTFD.

@markushi
Copy link
Member

markushi commented Aug 28, 2024

Quoting some internal discussion around this:

Yes, you can. You “just” need to adhere to using the right txn/span op names and measurements.

  • Every screens needs to be a transaction created with op="ui.load"
  • TTID needs to be a span tracked with op="ui.load.initial_display"
  • TTFD needs to be a span created with op="ui.load.full_display"
  • On top of that the TTID/TTFD need to be set as a measurement as well

Here's a more complete pseudo-code example:

// start a new transaction on every screen load / navigation event
val screenTransaction = Sentry.startTransaction(op="ui.load", description="My Compose Screen")
val ttidSpan = screenTransaction.startSpan(op="ui.load.initial_display",  description="My Compose Screen TTID")
val ttfdSpan = screenTransaction.startSpan(op="ui.load.full_display",  description="My Compose Screen TTFD")

// after the first frame is drawn, finish TTID
ttidSpan.finish()
screenTransaction.setMeasurement("time_to_initial_display", <duration>, MeasurementUnit.Duration.MILLISECOND)

// after the screen data is loaded, finish TTFD
ttfdSpan.finish()
screenTransaction.setMeasurement("time_to_full_display", <duration>, MeasurementUnit.Duration.MILLISECOND)


// finally, finish the transaction, so it can be sent to sentry
screenTransaction.finish()

@markushi
Copy link
Member

Relevant GH issue for adding a screens API is over here.

@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 3 Aug 28, 2024
@markushi markushi moved this from Needs Discussion to Needs More Information in Mobile & Cross Platform SDK Aug 28, 2024
@markushi markushi moved this from Needs More Information to Backlog in Mobile & Cross Platform SDK Sep 4, 2024
@getsantry getsantry bot removed the status in GitHub Issues with 👀 3 Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Backlog
Development

No branches or pull requests

4 participants