sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

App Cold/Warm Start not correct with react-native-navigation

Open moonjava2005 opened this issue 1 year ago • 6 comments

OS:

  • [ ] Windows
  • [ X] MacOS
  • [ ] Linux

Platform:

  • [ X] iOS
  • [ X] Android

SDK:

  • [X ] @sentry/react-native (>= 1.0.0)
  • [ ] react-native-sentry (<= 0.43.2)

SDK version: 5.11.1

react-native version: 0.72.6

Are you using Expo?

  • [ ] Yes
  • [X ] No

Are you using sentry.io or on-premise?

  • [X ] sentry.io (SaaS)
  • [ ] on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:

[Link to issue]

Configuration:

(@sentry/react-native)

Sentry.init({
      dsn:'https://[email protected]/XXXXX512',
      release:'com.a.b',
      dist:'0.1.1',
      environment: 'debug',
      integrations: [
        new Sentry.ReactNativeTracing({
          routingInstrumentation:
            new Sentry.ReactNativeNavigationInstrumentation(Navigation),
        }),
      ],
    })

or

(react-native-sentry)

Sentry.config(
  'https://[email protected]/...'
  // other options
 ).install();

I have the following issue: The App Cold/Warm start time is incorrect with "react-native-navigation": "7.37.2" I try to naming the isolated environment name debug in order to tracing from may real phone only. I found that:

  • The app open on my real phone is around 2-3 seconds (slowest is around 5 seconds) to see the first content of screen
  • However, after a while, I check transaction on Sentry, the Start Cold/Warm time up to 59 seconds (a big big value)

Actual result:

[Actual result] Screenshot 2023-12-17 at 17 02 09 Screenshot 2023-12-17 at 17 03 23

Expected result:

[Expected result] I expected the value should be exact the time of app start

moonjava2005 avatar Dec 17 '23 10:12 moonjava2005

Hey @moonjava2005 thanks for the report, we'll look into this. Please be aware that due to vacations and incoming holidays we might be slower to respond than usual.

kahest avatar Dec 19 '23 10:12 kahest

Hi @moonjava2005, were you able to reproduce this on a simulator or only on a device? Was the device Android or iOS?

Can you share a minimal reproducible example? If not, please describe your navigation setup. I've tried simple stack navigation with [email protected] and the start times were correct.

krystofwoldrich avatar Jan 05 '24 11:01 krystofwoldrich

Hi @moonjava2005, were you able to reproduce this on a simulator or only on a device? Was the device Android or iOS?

Can you share a minimal reproducible example? If not, please describe your navigation setup. I've tried simple stack navigation with [email protected] and the start times were correct.

Hi @krystofwoldrich You could try with setRoot as 5 tabs, each tab has a stack I have to "hack" this incorrect statistic by trying to ignore "App Start" event. Then, everything is working well with all simulator and real devices

moonjava2005 avatar Jan 08 '24 05:01 moonjava2005

@moonjava2005 Thank will try!

What do you mean by "hack"? Ignore the "App Start" in the SDK or the Sentry Product.

krystofwoldrich avatar Jan 09 '24 10:01 krystofwoldrich

@moonjava2005 Thank will try!

What do you mean by "hack"? Ignore the "App Start" in the SDK or the Sentry Product.

I hacked by setting startTime is 0 I guess the issue is:

  • When the app has just started, Sentry create the transaction in hub (I call this is Start transaction)
  • While app starting, and the first JSX is mounting, there're other transaction (like network,...), in this case, these actions will be added as the span of the start transaction
  • Then, JSX start rendering the first frame, but, there're other spans (inside the start transaction) have not finished yet. Therefore, start transaction will be prolong. As the result, the start transaction will be finish after all other spans finish. This cause the start time transaction is not correct I guess the scenario like this while I was taking a glimpse on the source code You can test by make some mock API call with slow response. These requests should be called at index.js and before mounting the first JSX. Then, you can see the result

moonjava2005 avatar Jan 10 '24 08:01 moonjava2005

@moonjava2005 Thank you for the details.

krystofwoldrich avatar Jan 11 '24 11:01 krystofwoldrich

Let's create a new RN application with react-native-navigation and Sentry RN SDK and check the app start measurements and spans which are reported.

Let's test this on simulator and real device.

krystofwoldrich avatar Jun 07 '24 12:06 krystofwoldrich

Hi @moonjava2005, I have tried to reproduce this issue on both physical and simulated devices (Android and iOS), but so far, I haven't noticed any issues on a new React Native application using native navigation.

Could you try checking if the issue still occurs when you use the latest Sentry React Native SDK? If the problem persists, could you share the application start up log with debug set to true in the Sentry options?

lucas-zimerman avatar Jun 13 '24 12:06 lucas-zimerman

Since we can't reproduce the issue I'm closing this. In case there is a new context or reproducible example, please, comment here and we can reopen it.

krystofwoldrich avatar Jun 21 '24 12:06 krystofwoldrich