From 55abee0616686ef7ecf67fdc761e56921b259574 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Tue, 1 Apr 2025 14:25:01 -0800 Subject: [PATCH 1/9] feat(profiling[cocoa]): update docs for profiling v2 --- docs/platforms/apple/common/index.mdx | 95 +++++++------- .../apple/common/profiling/index.mdx | 124 ++++++++++++++---- docs/platforms/apple/index.mdx | 2 +- 3 files changed, 147 insertions(+), 74 deletions(-) diff --git a/docs/platforms/apple/common/index.mdx b/docs/platforms/apple/common/index.mdx index 3caf1f19e63c9..fdf98487349c5 100644 --- a/docs/platforms/apple/common/index.mdx +++ b/docs/platforms/apple/common/index.mdx @@ -87,7 +87,7 @@ To capture all errors, initialize the SDK as soon as possible, such as in your ` -```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16", "profiling": "18-28"}} +```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16", "profiling": "17-21"}} import Sentry func application(_ application: UIApplication, @@ -101,27 +101,21 @@ func application(_ application: UIApplication, // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/ options.sendDefaultPii = true - // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. + // Set tracesSampleRate to 1 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. - options.tracesSampleRate = 1.0 + options.tracesSampleRate = 1 + + options.configureProfiling = { + $0.lifecycle = .trace + $0.sessionSampleRate = 1 + } } - // Manually call startProfiler and stopProfiler to profile any code that runs in between. - SentrySDK.startProfiler() - - // - // ...anything here will be profiled... - // - - // Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling - // your application until the process exits, the app goes to the background, or stopProfiling is called. - SentrySDK.stopProfiler() - return true } ``` -```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15", "profiling": "17-27"}} +```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15", "profiling": "16-20"}} @import Sentry; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { @@ -136,25 +130,19 @@ func application(_ application: UIApplication, // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. - options.tracesSampleRate = @1.0; + options.tracesSampleRate = @1.f; + + options.configureProfiling = ^(SentryProfileOptions *profiling) { + profiling.lifecycle = SentryProfileLifecycleTrace; + profiling.sessionSampleRate = 1.f; + }; }]; - // Manually call startProfiler and stopProfiler to profile any code that runs in between. - [SentrySDK startProfiler]; - - // - // ...anything here will be profiled... - // - - // Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling - // your application until the process exits, the app goes to the background, or stopProfiling is called. - [SentrySDK stopProfiler]; - return YES; } ``` -```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16", "profiling": "18-28"}} +```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16", "profiling": "17-21"}} import Sentry @main @@ -168,21 +156,15 @@ struct SwiftUIApp: App { // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/ options.sendDefaultPii = true - // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. + // Set tracesSampleRate to 1 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. - options.tracesSampleRate = 1.0 + options.tracesSampleRate = 1 + + options.configureProfiling = { + $0.lifecycle = .trace + $0.sessionSampleRate = 1 + } } - - // Manually call startProfiler and stopProfiler to profile any code that runs in between. - SentrySDK.startProfiler() - - // - // ...anything here will be profiled... - // - - // Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling - // your application until the process exits, the app goes to the background, or stopProfiling is called. - SentrySDK.stopProfiler() } } ``` @@ -190,7 +172,7 @@ struct SwiftUIApp: App { -```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16"}} +```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16", "profiling": "17-21"}} import Sentry func application(_ application: UIApplication, @@ -204,16 +186,21 @@ func application(_ application: UIApplication, // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/ options.sendDefaultPii = true - // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. + // Set tracesSampleRate to 1 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. - options.tracesSampleRate = 1.0 + options.tracesSampleRate = 1 + + options.configureProfiling = { + $0.lifecycle = .trace + $0.sessionSampleRate = 1 + } } return true } ``` -```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15"}} +```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15", "profiling": "16-20"}} @import Sentry; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { @@ -228,14 +215,19 @@ func application(_ application: UIApplication, // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. - options.tracesSampleRate = @1.0; + options.tracesSampleRate = @1.f; + + options.configureProfiling = ^(SentryProfileOptions *profiling) { + profiling.lifecycle = SentryProfileLifecycleTrace; + profiling.sessionSampleRate = 1.f; + }; }]; return YES; } ``` -```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16"}} +```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16", "profiling": "17-21"}} import Sentry @main @@ -249,9 +241,14 @@ struct SwiftUIApp: App { // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/ options.sendDefaultPii = true - // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. + // Set tracesSampleRate to 1 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. - options.tracesSampleRate = 1.0 + options.tracesSampleRate = 1 + + options.configureProfiling = { + $0.lifecycle = .trace + $0.sessionSampleRate = 1 + } } } } diff --git a/docs/platforms/apple/common/profiling/index.mdx b/docs/platforms/apple/common/profiling/index.mdx index 2b7a080b6a82f..3425622200ea7 100644 --- a/docs/platforms/apple/common/profiling/index.mdx +++ b/docs/platforms/apple/common/profiling/index.mdx @@ -15,17 +15,24 @@ notSupported: -## Enable Tracing +## Enable Profiling + + -Profiling depends on Sentry’s Tracing product being enabled beforehand. To enable tracing in the SDK: +Profiling V2 was introduced in SDK version 8.49.0. All prior profiling API are deprecated and will be removed in a future major version of the SDK. + + +To configure profiling, assign a closure to `SentryOptions.configureProfiling`, setting the desired options on the object passed in as parameter: ```swift {tabTitle:Swift} import Sentry SentrySDK.start { options in options.dsn = "___PUBLIC_DSN___" - options.tracesSampleRate = 1.0 + options.configureProfiling = { + $0.sessionSampleRate = 1 + } } ``` @@ -34,22 +41,81 @@ SentrySDK.start { options in [SentrySDK startWithConfigureOptions:^(SentryOptions *options) { options.dsn = @"___PUBLIC_DSN___"; - options.tracesSampleRate = @1.0; + options.configureProfiling = ^(SentryProfileOptions *profiling) { + profiling.sessionSampleRate = 1.f; + }; }]; ``` -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. +By default, `sessionSampleRate` is `0`, so you'll need to set it to a higher value to receive profile data. `sessionSampleRate` is evaluated once per user session and applies to any attempt to start a profile until the next user session starts. See user session documentation for more information on user sessions. -By default, some transactions will be created automatically for common operations like loading a view controller/activity and app startup. +See the subsections below to learn about the various ways the profiler can be started and stopped. -## Enable Profiling +### Manual Lifecycle + +By default, the profiler can only be started and stopped manually with calls to `SentrySDK.startProfiler` and `SentrySDK.stopProfiler`. All code that executes on all threads in between those calls will be recorded. The configurations shown above demonstrate configuring manual profiling mode. + +### Trace Lifecycle + +The profiler can be configured to start when a new root span is started where none already exist, and stopped when there are no root spans remaining. For this mode, you must set the `SentryProfileOptions.lifecycle` property to `SentryProfileLifecycleTrace` and ensure some traces will be sampled: + +```swift {tabTitle:Swift} +import Sentry + +SentrySDK.start { options in + options.dsn = "___PUBLIC_DSN___" + options.tracesSampleRate = 1 + options.configureProfiling = { + $0.sessionSampleRate = 1 + $0.lifecycle = .trace + } +} +``` + +```objc {tabTitle:Objective-C} +@import Sentry; + +[SentrySDK startWithConfigureOptions:^(SentryOptions *options) { + options.dsn = @"___PUBLIC_DSN___"; + options.tracesSampleRate = @1.f; + options.configureProfiling = ^(SentryProfileOptions *profiling) { + profiling.sessionSampleRate = 1.f; + profiling.lifecycle = SentryProfileLifecycleTrace; + }; +}]; +``` + + + +The `sessionSampleRate` for profiles is undersampled with respect to the `tracesSampleRate`. + + + +Check out the tracing setup documentation for more detailed information on how to configure sampling for Sentry Tracing. + +### App Starts + +If configured with manual lifecycle, then a profile starts on the next app launch, and continues until you call `SentrySDK.stopProfiler`. + +If configured with trace lifecycle, then app start profiles are attached to a special performance transaction operation called `app.launch` and displayed in the product simply as `launch`, which is stopped either when `SentrySDK.startWithOptions` is called, or, if TTID/TTFD tracking is enabled, when the SDK determines that TTID/TTFD has been reached. + +Every time `SentrySDK.startWithOptions` is called with app start profiling configured, a separate sample decision is generated with `sessionSampleRate` and stored until the next app launch (as well as `tracesSampleRate` if trace profile lifecycle is configured). The same sample decision will apply for the remainder of the profile session following that subsequent launch. + +## Transaction Profiling (deprecated) -iOS profiling is available starting in SDK version `8.12.0`. +Profiling configuration as explained below was originally introduced in SDK version `8.12.0` and is deprecated in favor of profiling V2 introduced in 8.49.0, explained at the beginning of this section. + + +Profiling depends on Sentry’s Tracing product being enabled beforehand. Check out the tracing setup documentation for more detailed information on how to configure sampling. + + + +Configure the sampling rates for traces and profiles to ensure they are nonzero so that some are recorded. The setting is _relative_ to the setting. ```swift {tabTitle:Swift} import Sentry @@ -58,7 +124,6 @@ SentrySDK.start { options in options.dsn = "___PUBLIC_DSN___" options.tracesSampleRate = 1.0 // tracing must be enabled for profiling options.profilesSampleRate = 1.0 // see also `profilesSampler` if you need custom sampling logic - options.enableAppLaunchProfiling = true // experimental new feature to start profiling in the pre-main launch phase } ``` @@ -69,26 +134,17 @@ SentrySDK.start { options in options.dsn = @"___PUBLIC_DSN___"; options.tracesSampleRate = @1.0; // tracing must be enabled for profiling options.profilesSampleRate = @1.0; // see also `profilesSampler` if you need custom sampling logic - options.enableAppLaunchProfiling = YES; // experimental new feature to start profiling in the pre-main launch phase }]; ``` - - -The setting is _relative_ to the setting. - - - -## Enable Launch Profiling +## Launch Profiling (deprecated) -This feature is experimental and may have bugs. +Launch profiling configuration as explained below was originally introduced in SDK version 8.21.0 and is deprecated in favor of profiling V2 configuration released in 8.49.0, explained at the beginning of this section. -_(New in version 8.21.0)_ - Normally, a profile can only be taken during a trace span after the SDK has been initialized. Now, you can configure the SDK to automatically profile certain app launches. To set up launch profiling, use the `enableAppLaunchProfiling` option and configure the sample rates for traces and profiles with `SentrySDK.startWithOptions` to determine if the subsequent app launch should be automatically profiled. This allows you to gather information on what is going on in your app even before `main` is called, making it easier to diagnose issues with slow app launches. @@ -97,16 +153,36 @@ If you use `SentryOptions.tracesSampler` or `SentryOptions.profilesSampler`, it Currently, launch profiles are attached to a special performance transaction operation called `app.launch` and displayed in the product simply as `launch`. -## Continuous Profiling +```swift {tabTitle:Swift} +import Sentry + +SentrySDK.start { options in + options.dsn = "___PUBLIC_DSN___" + options.tracesSampleRate = 1.0 // tracing must be enabled for profiling + options.profilesSampleRate = 1.0 // see also `profilesSampler` if you need custom sampling logic + options.enableAppLaunchProfiling = true +} +``` + +```objc {tabTitle:Objective-C} +@import Sentry; + +[SentrySDK startWithConfigureOptions:^(SentryOptions *options) { + options.dsn = @"___PUBLIC_DSN___"; + options.tracesSampleRate = @1.0; // tracing must be enabled for profiling + options.profilesSampleRate = @1.0; // see also `profilesSampler` if you need custom sampling logic + options.enableAppLaunchProfiling = YES; +}]; +``` + +## Continuous Profiling (deprecated) -This feature is experimental and may have bugs. +Continuous profiling as explained below was originally introduced in SDK version 8.36.0 and is deprecated in favor of profiling V2 configuration released in 8.49.0, explained at the beginning of this section. -_(New in version 8.36.0)_ - The current profiling implementation stops the profiler automatically after 30 seconds (unless you manually stop it earlier). Naturally, this limitation makes it difficult to get full coverage of your app's execution. We now offer an experimental continuous mode, where profiling data is periodically uploaded while running, with no limit to how long the profiler may run. Previously, profiles only ran in tandem with performance transactions that were started either automatically or manually with `SentrySDK.startTransaction`. Now, you can start and stop the profiler directly with `SentrySDK.startProfiler` and `SentrySDK.stopProfiler`. You can also start a profile at app launch by setting `SentryOptions.enableAppLaunchProfiling = true` in your call to `SentrySDK.startWithOptions`. diff --git a/docs/platforms/apple/index.mdx b/docs/platforms/apple/index.mdx index 262d871773ba9..87e696cd5bc85 100644 --- a/docs/platforms/apple/index.mdx +++ b/docs/platforms/apple/index.mdx @@ -12,6 +12,6 @@ keywords: - swift --- -Sentry supports the Apple platform via the `sentry-cocoa` SDK. Select your platform to get started: +Sentry supports Apple platforms via the [`sentry-cocoa`](https://github.com/getsentry/sentry-cocoa) SDK. Select your platform to get started: From 05c88ad32e1868019376be710c250b58d2fb1446 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Tue, 1 Apr 2025 15:29:50 -0800 Subject: [PATCH 2/9] add example of manual profiling --- .../apple/common/profiling/index.mdx | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/platforms/apple/common/profiling/index.mdx b/docs/platforms/apple/common/profiling/index.mdx index 3425622200ea7..92559cf9d6acc 100644 --- a/docs/platforms/apple/common/profiling/index.mdx +++ b/docs/platforms/apple/common/profiling/index.mdx @@ -55,6 +55,31 @@ See the subsections below to learn about the various ways the profiler can be st By default, the profiler can only be started and stopped manually with calls to `SentrySDK.startProfiler` and `SentrySDK.stopProfiler`. All code that executes on all threads in between those calls will be recorded. The configurations shown above demonstrate configuring manual profiling mode. +For example, if you wanted to profile everything that happens after starting a network request, and then updating a table view with the contents of the response, you could do is as follows (assuming you've already started the Sentry SDK with the options as shown above): + +```swift {tabTitle:Swift} +import Sentry + +struct MyModel: Codable { + // fields... +} +var model: MyModel? +var tableView: UITableView! + +@IBAction func updateTable() { + SentrySDK.startProfiler() + URLSession.shared.dataTask(with: URLRequest(url: URL(string: "https://my.domain.tld/endpoint")!)) { data, response, error in + self.model = try! JSONDecoder().decode(MyModel.self, from: data!) + DispatchQueue.main.async { + self.tableView.reloadData() + SentrySDK.stopProfiler() + } + } +} +``` + +This would capture every stacktrace on every thread involved with performing the network request, decoding the response and rebuilding the cells in the table view. + ### Trace Lifecycle The profiler can be configured to start when a new root span is started where none already exist, and stopped when there are no root spans remaining. For this mode, you must set the `SentryProfileOptions.lifecycle` property to `SentryProfileLifecycleTrace` and ensure some traces will be sampled: From d9203cff37b6502822b2a8bf1d62dcac2c6163c2 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 3 Apr 2025 16:57:42 -0800 Subject: [PATCH 3/9] improve table view example --- docs/platforms/apple/common/profiling/index.mdx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/platforms/apple/common/profiling/index.mdx b/docs/platforms/apple/common/profiling/index.mdx index 92559cf9d6acc..2db0f62cabb3d 100644 --- a/docs/platforms/apple/common/profiling/index.mdx +++ b/docs/platforms/apple/common/profiling/index.mdx @@ -71,8 +71,11 @@ var tableView: UITableView! URLSession.shared.dataTask(with: URLRequest(url: URL(string: "https://my.domain.tld/endpoint")!)) { data, response, error in self.model = try! JSONDecoder().decode(MyModel.self, from: data!) DispatchQueue.main.async { - self.tableView.reloadData() - SentrySDK.stopProfiler() + self.tableView.performBatchUpdates { + // update table view with model + } completion: { finished in + SentrySDK.stopProfiler() + } } } } From 5f099921cd23d6b032e0d1ffad83f024c747d183 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Fri, 4 Apr 2025 13:08:12 -0800 Subject: [PATCH 4/9] Update docs/platforms/apple/common/profiling/index.mdx Co-authored-by: Shannon Anahata --- docs/platforms/apple/common/profiling/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/apple/common/profiling/index.mdx b/docs/platforms/apple/common/profiling/index.mdx index 2db0f62cabb3d..8104bdb02d7e9 100644 --- a/docs/platforms/apple/common/profiling/index.mdx +++ b/docs/platforms/apple/common/profiling/index.mdx @@ -55,7 +55,7 @@ See the subsections below to learn about the various ways the profiler can be st By default, the profiler can only be started and stopped manually with calls to `SentrySDK.startProfiler` and `SentrySDK.stopProfiler`. All code that executes on all threads in between those calls will be recorded. The configurations shown above demonstrate configuring manual profiling mode. -For example, if you wanted to profile everything that happens after starting a network request, and then updating a table view with the contents of the response, you could do is as follows (assuming you've already started the Sentry SDK with the options as shown above): +For example, if you wanted to profile everything that happens after starting a network request, and then update a table view with the contents of the response, you could do it like this (assuming you've already started the Sentry SDK with the options shown above): ```swift {tabTitle:Swift} import Sentry From 02854da98d9c37d63ade525dad9fb2e1b70dc329 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Fri, 4 Apr 2025 13:14:16 -0800 Subject: [PATCH 5/9] Update docs/platforms/apple/common/profiling/index.mdx Co-authored-by: Shannon Anahata --- docs/platforms/apple/common/profiling/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/apple/common/profiling/index.mdx b/docs/platforms/apple/common/profiling/index.mdx index 8104bdb02d7e9..bf63672768e49 100644 --- a/docs/platforms/apple/common/profiling/index.mdx +++ b/docs/platforms/apple/common/profiling/index.mdx @@ -123,7 +123,7 @@ Check out the tracing setup documentationTTID/TTFD tracking is enabled, when the SDK determines that TTID/TTFD has been reached. From 883dd022881dd05a4d0ae40acdc8764ccbc83f8f Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Fri, 4 Apr 2025 13:14:48 -0800 Subject: [PATCH 6/9] Update docs/platforms/apple/common/profiling/index.mdx Co-authored-by: Shannon Anahata --- docs/platforms/apple/common/profiling/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/apple/common/profiling/index.mdx b/docs/platforms/apple/common/profiling/index.mdx index bf63672768e49..0a653af391727 100644 --- a/docs/platforms/apple/common/profiling/index.mdx +++ b/docs/platforms/apple/common/profiling/index.mdx @@ -125,7 +125,7 @@ Check out the tracing setup documentationTTID/TTFD tracking is enabled, when the SDK determines that TTID/TTFD has been reached. +If configured with trace lifecycle, app start profiles are attached to a special performance transaction operation called `app.launch` and displayed in the product as `launch`. It is stopped either when `SentrySDK.startWithOptions` is called, or, if TTID/TTFD tracking is enabled, when the SDK determines that TTID/TTFD has been reached. Every time `SentrySDK.startWithOptions` is called with app start profiling configured, a separate sample decision is generated with `sessionSampleRate` and stored until the next app launch (as well as `tracesSampleRate` if trace profile lifecycle is configured). The same sample decision will apply for the remainder of the profile session following that subsequent launch. From d0f0956c577aec57b1077efe2ab68ad9a1c1e990 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Fri, 4 Apr 2025 13:21:46 -0800 Subject: [PATCH 7/9] Apply suggestions from code review Co-authored-by: Shannon Anahata --- docs/platforms/apple/common/profiling/index.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/platforms/apple/common/profiling/index.mdx b/docs/platforms/apple/common/profiling/index.mdx index 0a653af391727..6bd8da60ff87e 100644 --- a/docs/platforms/apple/common/profiling/index.mdx +++ b/docs/platforms/apple/common/profiling/index.mdx @@ -133,13 +133,13 @@ Every time `SentrySDK.startWithOptions` is called with app start profiling confi -Profiling configuration as explained below was originally introduced in SDK version `8.12.0` and is deprecated in favor of profiling V2 introduced in 8.49.0, explained at the beginning of this section. +Profiling configuration, explained below, was originally introduced in SDK version `8.12.0`. It is now deprecated in favor of profiling V2, introduced in 8.49.0. -Profiling depends on Sentry’s Tracing product being enabled beforehand. Check out the tracing setup documentation for more detailed information on how to configure sampling. +Profiling depends on Sentry’s Tracing product being enabled beforehand. Check out the tracing setup documentation for detailed information on how to configure sampling. @@ -169,7 +169,7 @@ SentrySDK.start { options in -Launch profiling configuration as explained below was originally introduced in SDK version 8.21.0 and is deprecated in favor of profiling V2 configuration released in 8.49.0, explained at the beginning of this section. +Launch profiling configuration, explained below, was originally introduced in SDK version 8.21.0. It is now deprecated in favor of profiling V2 configuration, released in 8.49.0. @@ -207,7 +207,7 @@ SentrySDK.start { options in -Continuous profiling as explained below was originally introduced in SDK version 8.36.0 and is deprecated in favor of profiling V2 configuration released in 8.49.0, explained at the beginning of this section. +Continuous profiling, explained below, was originally introduced in SDK version 8.36.0. It is now deprecated in favor of profiling V2 configuration, released in 8.49.0. From 86cbf85d19141215283670d6c9949dcb6d0ce842 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Fri, 4 Apr 2025 13:21:54 -0800 Subject: [PATCH 8/9] pr feedback --- docs/platforms/apple/common/profiling/index.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/platforms/apple/common/profiling/index.mdx b/docs/platforms/apple/common/profiling/index.mdx index 6bd8da60ff87e..cb17cea8872e1 100644 --- a/docs/platforms/apple/common/profiling/index.mdx +++ b/docs/platforms/apple/common/profiling/index.mdx @@ -1,6 +1,6 @@ --- title: Set Up Profiling -description: "Learn how to enable profiling in your app if it is not already set up." +description: "Learn how to enable profiling in your app." sidebar_order: 5000 supported: - apple @@ -53,7 +53,7 @@ See the subsections below to learn about the various ways the profiler can be st ### Manual Lifecycle -By default, the profiler can only be started and stopped manually with calls to `SentrySDK.startProfiler` and `SentrySDK.stopProfiler`. All code that executes on all threads in between those calls will be recorded. The configurations shown above demonstrate configuring manual profiling mode. +By default, the profiler can only be started and stopped manually with calls to `SentrySDK.startProfiler` and `SentrySDK.stopProfiler`. All code that executes on all threads in between those calls will be recorded. The snippets above demonstrate configuring manual profiling mode. For example, if you wanted to profile everything that happens after starting a network request, and then update a table view with the contents of the response, you could do it like this (assuming you've already started the Sentry SDK with the options shown above): @@ -115,7 +115,7 @@ SentrySDK.start { options in -The `sessionSampleRate` for profiles is undersampled with respect to the `tracesSampleRate`. +The `sessionSampleRate` for profiles is _relative_ to the `tracesSampleRate`: if `tracesSampleRate` and `sessionSampleRate` are both `0.5`, then on average 25% of attempts to start the profiler will result in actual data collection. @@ -125,7 +125,7 @@ Check out the tracing setup documentationTTID/TTFD tracking is enabled, when the SDK determines that TTID/TTFD has been reached. +If configured with trace lifecycle, app start profiles are attached to a special performance transaction operation called `app.launch` and displayed in the product as `launch`. It is stopped either when `SentrySDK.startWithOptions` is called, or, if Time to Initial Display (TTID)/Time to Full Display (TTFD) tracking is enabled, when the SDK determines that TTID/TTFD has been reached. Every time `SentrySDK.startWithOptions` is called with app start profiling configured, a separate sample decision is generated with `sessionSampleRate` and stored until the next app launch (as well as `tracesSampleRate` if trace profile lifecycle is configured). The same sample decision will apply for the remainder of the profile session following that subsequent launch. From cdcc6c05654b0bc8b47ac171d8716779b0badd83 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Fri, 4 Apr 2025 13:26:04 -0800 Subject: [PATCH 9/9] more feedback --- docs/platforms/apple/common/profiling/index.mdx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/platforms/apple/common/profiling/index.mdx b/docs/platforms/apple/common/profiling/index.mdx index cb17cea8872e1..06434031cd466 100644 --- a/docs/platforms/apple/common/profiling/index.mdx +++ b/docs/platforms/apple/common/profiling/index.mdx @@ -15,11 +15,11 @@ notSupported: -## Enable Profiling +## Enable UI Profiling -Profiling V2 was introduced in SDK version 8.49.0. All prior profiling API are deprecated and will be removed in a future major version of the SDK. +UI Profiling was introduced in SDK version 8.49.0. All prior profiling API are deprecated and will be removed in a future major version of the SDK. @@ -129,17 +129,17 @@ If configured with trace lifecycle, app start profiles are attached to a special Every time `SentrySDK.startWithOptions` is called with app start profiling configured, a separate sample decision is generated with `sessionSampleRate` and stored until the next app launch (as well as `tracesSampleRate` if trace profile lifecycle is configured). The same sample decision will apply for the remainder of the profile session following that subsequent launch. -## Transaction Profiling (deprecated) +## Transaction-based Profiling (deprecated) -Profiling configuration, explained below, was originally introduced in SDK version `8.12.0`. It is now deprecated in favor of profiling V2, introduced in 8.49.0. +Profiling configuration, explained below, was originally introduced in SDK version `8.12.0`. It is now deprecated in favor of UI Profiling, introduced in 8.49.0. -Profiling depends on Sentry’s Tracing product being enabled beforehand. Check out the tracing setup documentation for detailed information on how to configure sampling. +Transaction-based Profiling depends on Sentry’s Tracing product being enabled beforehand. Check out the tracing setup documentation for detailed information on how to configure sampling. @@ -169,7 +169,7 @@ SentrySDK.start { options in -Launch profiling configuration, explained below, was originally introduced in SDK version 8.21.0. It is now deprecated in favor of profiling V2 configuration, released in 8.49.0. +Launch profiling configuration, explained below, was originally introduced in SDK version 8.21.0. It is now deprecated in favor of UI Profiling, released in 8.49.0. @@ -203,11 +203,11 @@ SentrySDK.start { options in }]; ``` -## Continuous Profiling (deprecated) +## Continuous Profiling Beta (deprecated) -Continuous profiling, explained below, was originally introduced in SDK version 8.36.0. It is now deprecated in favor of profiling V2 configuration, released in 8.49.0. +Continuous Profiling Beta, explained below, was originally introduced in SDK version 8.36.0. It is now deprecated in favor of UI Profiling, released in 8.49.0.