|
28 | 28 | NSString *const kSentryLaunchProfileConfigKeyTracesSampleRand = @"traces.sample_rand"; |
29 | 29 | NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRate = @"profiles"; |
30 | 30 | NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRand = @"profiles.sample_rand"; |
31 | | -NSString *const kSentryLaunchProfileConfigKeyContinuousProfilingV2 |
32 | | - = @"continuous-profiling-v2-enabled"; |
33 | 31 | NSString *const kSentryLaunchProfileConfigKeyContinuousProfilingV2Lifecycle |
34 | 32 | = @"continuous-profiling-v2-lifecycle"; |
35 | 33 | NSString *const kSentryLaunchProfileConfigKeyWaitForFullDisplay |
|
254 | 252 | NSDictionary<NSString *, NSNumber *> *persistedLaunchConfigOptionsDict |
255 | 253 | = sentry_persistedLaunchProfileConfigurationOptions(); |
256 | 254 |
|
257 | | - BOOL isContinuousV2 = |
258 | | - [persistedLaunchConfigOptionsDict[kSentryLaunchProfileConfigKeyContinuousProfilingV2] |
259 | | - boolValue]; |
260 | | - |
261 | 255 | SentrySamplerDecision *decision |
262 | 256 | = _sentry_profileSampleDecision(persistedLaunchConfigOptionsDict); |
263 | 257 | if (nil == decision) { |
|
279 | 273 | BOOL shouldWaitForFullDisplay = shouldWaitForFullDisplayValue.boolValue; |
280 | 274 |
|
281 | 275 | SentryProfileOptions *profileOptions = nil; |
282 | | - if (isContinuousV2) { |
283 | | - SENTRY_LOG_DEBUG(@"Starting continuous launch profile v2."); |
284 | | - NSNumber *lifecycleValue = persistedLaunchConfigOptionsDict |
285 | | - [kSentryLaunchProfileConfigKeyContinuousProfilingV2Lifecycle]; |
286 | | - if (lifecycleValue == nil) { |
287 | | - SENTRY_LOG_ERROR( |
288 | | - @"Missing expected launch profile config parameter for lifecycle. Will " |
289 | | - @"not proceed with launch profile."); |
290 | | - _sentry_cleanUpConfigFile(); |
291 | | - return; |
292 | | - } |
293 | | - |
294 | | - profileOptions = [[SentryProfileOptions alloc] init]; |
| 276 | + SENTRY_LOG_DEBUG(@"Starting continuous launch profile v2."); |
| 277 | + NSNumber *lifecycleValue = persistedLaunchConfigOptionsDict |
| 278 | + [kSentryLaunchProfileConfigKeyContinuousProfilingV2Lifecycle]; |
| 279 | + if (lifecycleValue == nil) { |
| 280 | + SENTRY_LOG_ERROR(@"Missing expected launch profile config parameter for lifecycle. Will " |
| 281 | + @"not proceed with launch profile."); |
| 282 | + _sentry_cleanUpConfigFile(); |
| 283 | + return; |
| 284 | + } |
295 | 285 |
|
296 | | - SentryProfileLifecycle lifecycle = lifecycleValue.intValue; |
297 | | - if (lifecycle == SentryProfileLifecycleManual) { |
298 | | - _sentry_continuousProfilingV2_startManualLaunchProfile(persistedLaunchConfigOptionsDict, |
299 | | - profileOptions, decision, shouldWaitForFullDisplay); |
300 | | - _sentry_cleanUpConfigFile(); |
301 | | - return; |
302 | | - } |
| 286 | + profileOptions = [[SentryProfileOptions alloc] init]; |
303 | 287 |
|
304 | | - _sentry_hydrateV2Options(persistedLaunchConfigOptionsDict, profileOptions, decision, |
305 | | - SentryProfileLifecycleTrace, shouldWaitForFullDisplay); |
306 | | - } else { |
307 | | - sentry_profileConfiguration = |
308 | | - [[SentryProfileConfiguration alloc] initWaitingForFullDisplay:shouldWaitForFullDisplay]; |
| 288 | + SentryProfileLifecycle lifecycle = lifecycleValue.intValue; |
| 289 | + if (lifecycle == SentryProfileLifecycleManual) { |
| 290 | + _sentry_continuousProfilingV2_startManualLaunchProfile( |
| 291 | + persistedLaunchConfigOptionsDict, profileOptions, decision, shouldWaitForFullDisplay); |
| 292 | + _sentry_cleanUpConfigFile(); |
| 293 | + return; |
309 | 294 | } |
310 | 295 |
|
| 296 | + _sentry_hydrateV2Options(persistedLaunchConfigOptionsDict, profileOptions, decision, |
| 297 | + SentryProfileLifecycleTrace, shouldWaitForFullDisplay); |
| 298 | + |
311 | 299 | // trace lifecycle UI profiling (continuous profiling v2) and trace-based profiling both join |
312 | 300 | // paths here |
313 | 301 | _sentry_startTraceProfiler(persistedLaunchConfigOptionsDict, decision); |
|
333 | 321 | [NSMutableDictionary<NSString *, NSNumber *> dictionary]; |
334 | 322 | configDict[kSentryLaunchProfileConfigKeyWaitForFullDisplay] = |
335 | 323 | @(options.enableTimeToFullDisplayTracing); |
336 | | - if ([options isContinuousProfilingEnabled]) { |
337 | | - SENTRY_LOG_DEBUG(@"Configuring continuous launch profile v2."); |
338 | | - configDict[kSentryLaunchProfileConfigKeyContinuousProfilingV2] = @YES; |
339 | | - configDict[kSentryLaunchProfileConfigKeyContinuousProfilingV2Lifecycle] = |
340 | | - @(options.profiling.lifecycle); |
341 | | - if (options.profiling.lifecycle == SentryProfileLifecycleTrace) { |
342 | | - configDict[kSentryLaunchProfileConfigKeyTracesSampleRate] |
343 | | - = config.tracesDecision.sampleRate; |
344 | | - configDict[kSentryLaunchProfileConfigKeyTracesSampleRand] |
345 | | - = config.tracesDecision.sampleRand; |
346 | | - } |
347 | | - configDict[kSentryLaunchProfileConfigKeyProfilesSampleRate] |
348 | | - = config.profilesDecision.sampleRate; |
349 | | - configDict[kSentryLaunchProfileConfigKeyProfilesSampleRand] |
350 | | - = config.profilesDecision.sampleRand; |
| 324 | + SENTRY_LOG_DEBUG(@"Configuring continuous launch profile v2."); |
| 325 | + configDict[kSentryLaunchProfileConfigKeyContinuousProfilingV2Lifecycle] = |
| 326 | + @(options.profiling.lifecycle); |
| 327 | + if (options.profiling.lifecycle == SentryProfileLifecycleTrace) { |
| 328 | + configDict[kSentryLaunchProfileConfigKeyTracesSampleRate] |
| 329 | + = config.tracesDecision.sampleRate; |
| 330 | + configDict[kSentryLaunchProfileConfigKeyTracesSampleRand] |
| 331 | + = config.tracesDecision.sampleRand; |
351 | 332 | } |
| 333 | + configDict[kSentryLaunchProfileConfigKeyProfilesSampleRate] |
| 334 | + = config.profilesDecision.sampleRate; |
| 335 | + configDict[kSentryLaunchProfileConfigKeyProfilesSampleRand] |
| 336 | + = config.profilesDecision.sampleRand; |
352 | 337 | writeAppLaunchProfilingConfigFile(configDict); |
353 | 338 | }]; |
354 | 339 | } |
|
0 commit comments