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

SentryFragmentLifecycleCallbacks creates long running spans for ViewPager2 #3269

Open
markushi opened this issue Mar 18, 2024 · 6 comments · May be fixed by #3424
Open

SentryFragmentLifecycleCallbacks creates long running spans for ViewPager2 #3269

markushi opened this issue Mar 18, 2024 · 6 comments · May be fixed by #3424
Labels
Platform: Android Sync: Jira apply to auto-create a Jira shadow ticket Type: Bug Something isn't working

Comments

@markushi
Copy link
Member

markushi commented Mar 18, 2024

Integration

sentry-android

Build System

Gradle

AGP Version

unknown

Proguard

Enabled

Version

unknown

Steps to Reproduce

  1. Use ViewPager2
  2. Enable performance and our FragmentLifecycleIntegration

Expected Result

No span is created for non-visible fragments.

Actual Result

A span is created, but due to this:

non-primary-item Fragments are capped at STARTED

the spans end up running into an timeout, causing extra long transaction durations.

We probably should be using getUserVisibleHint() or getMinimumMaxLifecycleState() to determine Fragments which won't be activated.

┆Issue is synchronized with this Jira Improvement by Unito

@markushi markushi added Type: Bug Something isn't working Platform: Android labels Mar 18, 2024
@markushi markushi changed the title SentryFragmentLifecycleCallbacks for ViewPager2 SentryFragmentLifecycleCallbacks creates long running spans for ViewPager2 Mar 18, 2024
@yuval-sentry yuval-sentry added the Sync: Jira apply to auto-create a Jira shadow ticket label Mar 19, 2024
@realkosty
Copy link

@markushi any updates on this?
I added a report from an enterprise customer in the linked Jira ticket. They believe the same issue is affecting their TTID.

@kahest
Copy link
Member

kahest commented Apr 26, 2024

cc @stefanosiano

@stefanosiano
Copy link
Member

we are going to take a look at this in the next week

@realkosty
Copy link

Hi @stefanosiano, were you guys able to make any progress on this one?

@stefanosiano
Copy link
Member

Hi @realkosty
I was having some problem, but now I'm finally able to reproduce it and working on it 👍

@stefanosiano
Copy link
Member

Options considered:

  • getUserVisibleHint(): it's deprecated and returns true for all fragments
  • mMaxState: only accessible through reflection and returns the current max state achieved (in onFragmentStarted it will be STARTED, while in onFragmentResumed it will be RESUMED
  • isVisible: returns true for all fragments

It seems like the only real option for us is to stop the span in onFragmentStarted instead of onFragmentResumed. Breadcrumbs will still be created correctly and most operations are going to be in Fragment.onCreate and associated callbacks, so it should be fine for users.

@stefanosiano stefanosiano linked a pull request May 15, 2024 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android Sync: Jira apply to auto-create a Jira shadow ticket Type: Bug Something isn't working
Projects
Status: No status
Status: No status
Status: Todo
Development

Successfully merging a pull request may close this issue.

6 participants