Set Up Profiling

Learn how to enable profiling in your app if it is not already set up.

With profiling, Sentry tracks your software's performance by sampling your program's call stack in a variety of environments. This feature collects function-level information about your code and enables you to fine-tune your program's performance. Sentry's profiler captures function calls and their exact locations, aggregates them, and shows you the most common code paths of your program. This highlights areas you could optimize to help increase both the performance of your code and increase user satisfaction, as well as drive down costs.

The profiling feature captures profiles across multiple language layers, including native languages (such as Swift and Objective-C) as well as Dart.

Flutter Profiling alpha is available for iOS and macOS since SDK version 7.12.0.

Profiling depends on Sentry’s Tracing product being enabled beforehand. To enable tracing in the SDK:

Copied
SentryFlutter.init(
  (options) => {
    options.dsn = 'https://examplePublicKey@o0.ingest.sentry.io/0';
+   // We recommend adjusting this value in production:
+   options.tracesSampleRate = 1.0;
  },
  appRunner: () => runApp(MyApp()),
);

Check out the tracing setup documentation for more detailed information on how to configure sampling. Setting the sample rate to 1.0 means all transactions will be captured.

To enable profiling, set the profilesSampleRate:

Copied
SentryFlutter.init(
  (options) => {
    options.dsn = 'https://examplePublicKey@o0.ingest.sentry.io/0';
    // We recommend adjusting this value in production:
    options.tracesSampleRate = 1.0;
+   // The sampling rate for profiling is relative to tracesSampleRate
+   // Setting to 1.0 will profile 100% of sampled transactions:
+   options.profilesSampleRate = 1.0;
  },
  appRunner: () => runApp(MyApp()),
);
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").