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:
- The Sentry Flutter SDK is nitialized. Learn more here
- 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.
- Set
autoAppStart
tofalse
in the Sentry options. - 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").
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").
- Package:
- pub:sentry_flutter
- Version:
- 7.19.0
- Repository:
- https://github.com/getsentry/sentry-dart
- API Documentation:
- https://pub.dev/documentation/sentry_flutter/latest/