Set Up Profiling
Learn how to enable profiling in your app if it is not already set up.
通过性能分析,Sentry 通过在各种环境中采样程序的调用栈来跟踪软件的性能。此功能收集关于代码的功能级信息,使你能够微调程序的性能。Sentry 的性能分析器捕获函数调用及其确切位置,对它们进行聚合,并显示程序中最常见的代码路径。这突出了你可以优化的区域,以帮助提高代码性能和用户满意度,同时降低成本。
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()),
);