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

Not measuring App Start on consequent start #4286

Open
rodolfoBee opened this issue Nov 18, 2024 · 1 comment
Open

Not measuring App Start on consequent start #4286

rodolfoBee opened this issue Nov 18, 2024 · 1 comment

Comments

@rodolfoBee
Copy link
Member

What React Native libraries do you use?

Expo (mobile only)

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

6.1.0

How does your development environment look like?

NA

Sentry.init()

const nativeTracingIntegration = Sentry.reactNativeTracingIntegration({
idleTimeoutMs: 20000
});
const navigationIntegration = Sentry.reactNavigationIntegration({
enableTimeToInitialDisplay: true,
routeChangeTimeoutMs: 20000,
ignoreEmptyBackNavigationTransactions: false
});

Sentry.init({
dsn: CONFIG.SENTRY.DSN,
enableAutoSessionTracking: true,
environment: CONFIG.SENTRY.ENVIRONMENT,
normalizeDepth: 5,
tracesSampleRate: 1,
profilesSampleRate: 0,
integrations: [nativeTracingIntegration, navigationIntegration],
debug: DEV,
});

Steps to Reproduce

  1. Build the app and run it on an Android device
  2. Start the app and use any other tool to estimate the TTID of the app.
  3. Close the app
  4. Repeat step 2

I was not able to reproduce due to the lack of available test devices.

Expected Result

The measurement you make matches the TTID shown in the Sentry transactions reported by the application.

Actual Result

The TTID reported when the application is opened for the second time (step 4) does not match the measurements made.

In the tests, both load time take about 7 seconds. The first trace reported by sentry contains the cold start measurement and matches the user loading time experience:
Image

The second app start also takes about 7 seconds, but the transaction and TTID display in Sentry do not reflect it:
Image

The second transaction also do not report the app as "cold start".

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 18, 2024
@krystofwoldrich krystofwoldrich changed the title Incorrect TTID reported on older Android devices Not measuring App Start on consequent start Nov 20, 2024
@krystofwoldrich
Copy link
Member

Thank you @rodolfoBee for the details.

To investigate this, we would need the JS logs from the second application start.

From what I can see in the screenshots the reason for the shorter TTID is the missing app start as you mentioned.

There are multiple reasons for the app start to be missing, the logs would help us to investigate it further.

const appStart = await NATIVE.fetchNativeAppStart();
if (!appStart) {
logger.warn('[AppStart] Failed to retrieve the app start metrics from the native layer.');
return;
}
if (appStart.has_fetched) {
logger.warn('[AppStart] Measured app start metrics were already reported from the native layer.');
return;
}
const appStartTimestampMs = appStart.app_start_timestamp_ms;
if (!appStartTimestampMs) {
logger.warn('[AppStart] App start timestamp could not be loaded from the native layer.');
return;
}
const appStartEndTimestampMs = recordedAppStartEndTimestampMs || getBundleStartTimestampMs();
if (!appStartEndTimestampMs) {
logger.warn(
'[AppStart] Javascript failed to record app start end. `setAppStartEndTimestampMs` was not called nor could the bundle start be found.',
);
return;
}
const isAppStartWithinBounds =
!!event.start_timestamp && appStartTimestampMs >= event.start_timestamp - MAX_APP_START_AGE_MS;
if (!__DEV__ && !isAppStartWithinBounds) {
logger.warn('[AppStart] App start timestamp is too far in the past to be used for app start span.');
return;
}
const appStartDurationMs = appStartEndTimestampMs - appStartTimestampMs;
if (!__DEV__ && appStartDurationMs >= MAX_APP_START_DURATION_MS) {
// Dev builds can have long app start waiting over minute for the first bundle to be produced
logger.warn('[AppStart] App start duration is over a minute long, not adding app start span.');
return;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Needs Discussion
Development

No branches or pull requests

2 participants