App Start Instrumentation

Sentry's app start instrumentation provides insight into how long your application takes to launch.

Before diving into the configuration, it's important to understand how app start instrumentation behaves:

  • The SDK attaches the app start metrics to the first run transaction.
  • It tracks the length of time from the earliest native process initialization until the very first PostFrameCallback is triggered.
  • The SDK differentiates between a cold and a warm start, but doesn't track hot starts/resumes.

Before starting, ensure:

  1. The Sentry Flutter SDK is nitialized. Learn more here
  2. Performance Monitoring is set up. Learn more here.

This type of instrumentation is automatically enabled. There is no need for further configuration.

Initiate a transaction immediately after the app launches.

Copied
import 'package:sentry/sentry.dart';

final transaction = Sentry.startTransaction("test test", "my operation");
await Future.delayed(const Duration(milliseconds: 1000));
transaction.finish();

Open the sentry.io performance dashboard, find, and select the transaction you executed.

Select the event within your transaction. Sentry.io displays the app start metrics on the right side of the screen.

  1. Set autoAppStart to false in the Sentry options.
  2. Call SentryFlutter.setAppStartEnd.
Copied
import 'package:sentry_flutter/sentry_flutter.dart';

// Run my App and do my things first

// Initialize the Flutter SDK
Future<void> main() async {
  await SentryFlutter.init(
    (options) => options.autoAppStart = false,
  );
}

// End the App Start metric
SentryFlutter.setAppStartEnd(DateTime.now().toUtc());
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").