@@ -87,7 +87,7 @@ To capture all errors, initialize the SDK as soon as possible, such as in your `
8787
8888<PlatformSection notSupported = { [" apple.tvos" , " apple.watchos" , " apple.visionos" ]} >
8989
90- ``` swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16", "profiling": "18-28 "}}
90+ ``` swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16", "profiling": "17-21 "}}
9191import Sentry
9292
9393func application (_ application : UIApplication,
@@ -101,27 +101,21 @@ func application(_ application: UIApplication,
101101 // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
102102 options.sendDefaultPii = true
103103
104- // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
104+ // Set tracesSampleRate to 1 to capture 100% of transactions for performance monitoring.
105105 // We recommend adjusting this value in production.
106- options.tracesSampleRate = 1.0
106+ options.tracesSampleRate = 1
107+
108+ options.configureProfiling = {
109+ $0 .lifecycle = .trace
110+ $0 .sessionSampleRate = 1
111+ }
107112 }
108113
109- // Manually call startProfiler and stopProfiler to profile any code that runs in between.
110- SentrySDK.startProfiler ()
111-
112- //
113- // ...anything here will be profiled...
114- //
115-
116- // Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling
117- // your application until the process exits, the app goes to the background, or stopProfiling is called.
118- SentrySDK.stopProfiler ()
119-
120114 return true
121115}
122116```
123117
124- ``` objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15", "profiling": "17-27 "}}
118+ ``` objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15", "profiling": "16-20 "}}
125119@import Sentry;
126120
127121- (BOOL )application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
@@ -136,25 +130,19 @@ func application(_ application: UIApplication,
136130
137131 // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
138132 // We recommend adjusting this value in production.
139- options .tracesSampleRate = @1.0 ;
133+ options .tracesSampleRate = @1.f ;
134+
135+ options .configureProfiling = ^ (SentryProfileOptions * profiling ) {
136+ profiling.lifecycle = SentryProfileLifecycleTrace ;
137+ profiling.sessionSampleRate = 1.f ;
138+ };
140139 } ] ;
141140
142- // Manually call startProfiler and stopProfiler to profile any code that runs in between.
143- [ SentrySDK startProfiler] ;
144-
145- //
146- // ...anything here will be profiled...
147- //
148-
149- // Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling
150- // your application until the process exits, the app goes to the background, or stopProfiling is called.
151- [ SentrySDK stopProfiler] ;
152-
153141 return YES;
154142}
155143```
156144
157- ``` swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16", "profiling": "18-28 "}}
145+ ``` swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16", "profiling": "17-21 "}}
158146import Sentry
159147
160148@main
@@ -168,29 +156,23 @@ struct SwiftUIApp: App {
168156 // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
169157 options.sendDefaultPii = true
170158
171- // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
159+ // Set tracesSampleRate to 1 to capture 100% of transactions for performance monitoring.
172160 // We recommend adjusting this value in production.
173- options.tracesSampleRate = 1.0
161+ options.tracesSampleRate = 1
162+
163+ options.configureProfiling = {
164+ $0 .lifecycle = .trace
165+ $0 .sessionSampleRate = 1
166+ }
174167 }
175-
176- // Manually call startProfiler and stopProfiler to profile any code that runs in between.
177- SentrySDK.startProfiler ()
178-
179- //
180- // ...anything here will be profiled...
181- //
182-
183- // Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling
184- // your application until the process exits, the app goes to the background, or stopProfiling is called.
185- SentrySDK.stopProfiler ()
186168 }
187169}
188170```
189171</PlatformSection >
190172
191173<PlatformSection notSupported = { [" apple.ios" , " apple.macos" ]} >
192174
193- ``` swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16"}}
175+ ``` swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16", "profiling": "17-21" }}
194176import Sentry
195177
196178func application (_ application : UIApplication,
@@ -204,16 +186,21 @@ func application(_ application: UIApplication,
204186 // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
205187 options.sendDefaultPii = true
206188
207- // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
189+ // Set tracesSampleRate to 1 to capture 100% of transactions for performance monitoring.
208190 // We recommend adjusting this value in production.
209- options.tracesSampleRate = 1.0
191+ options.tracesSampleRate = 1
192+
193+ options.configureProfiling = {
194+ $0 .lifecycle = .trace
195+ $0 .sessionSampleRate = 1
196+ }
210197 }
211198
212199 return true
213200}
214201```
215202
216- ``` objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15"}}
203+ ``` objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15", "profiling": "16-20" }}
217204@import Sentry;
218205
219206- (BOOL )application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
@@ -228,14 +215,19 @@ func application(_ application: UIApplication,
228215
229216 // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
230217 // We recommend adjusting this value in production.
231- options .tracesSampleRate = @1.0 ;
218+ options .tracesSampleRate = @1.f ;
219+
220+ options .configureProfiling = ^ (SentryProfileOptions * profiling ) {
221+ profiling.lifecycle = SentryProfileLifecycleTrace ;
222+ profiling.sessionSampleRate = 1.f ;
223+ };
232224 } ] ;
233225
234226 return YES;
235227}
236228```
237229
238- ``` swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16"}}
230+ ``` swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16", "profiling": "17-21" }}
239231import Sentry
240232
241233@main
@@ -249,9 +241,14 @@ struct SwiftUIApp: App {
249241 // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
250242 options.sendDefaultPii = true
251243
252- // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
244+ // Set tracesSampleRate to 1 to capture 100% of transactions for performance monitoring.
253245 // We recommend adjusting this value in production.
254- options.tracesSampleRate = 1.0
246+ options.tracesSampleRate = 1
247+
248+ options.configureProfiling = {
249+ $0 .lifecycle = .trace
250+ $0 .sessionSampleRate = 1
251+ }
255252 }
256253 }
257254}
0 commit comments