DataDog / dd-sdk-android

Datadog SDK for Android (Compatible with Kotlin and Java)
Apache License 2.0
150 stars 59 forks source link

Viewpager adjacent fragments have invalid loadingTime #1295

Open Albertoperezs90 opened 1 year ago

Albertoperezs90 commented 1 year ago

Describe what happened Fragments loaded by viewpager are created when visiting adjacents fragments but if you specify the flag BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT onResume() is not triggered until the fragment is actually visible to the user.

The above behavior is triggering viewLoadingTimer.onCreated() on all the adjacents fragments created, but because onResume() is not called until fragment is visible, the loadingTime is invalid giving bigger values than the real loadingTime.

Steps to reproduce the issue:

Describe what you expected:

Additional context

0xnm commented 1 year ago

Hello @Albertoperezs90. Thanks for opening the issue. Indeed, loading time reporting may be not correct because of the delayed lifecycle calls as you've described.

We will try to look at this and see how we can improve reporting.

Albertoperezs90 commented 1 year ago

Thanks @0xnm ! If you need any help, just let me know :)