From f360bfaa0d993886fa7ec49090d98460623650e4 Mon Sep 17 00:00:00 2001 From: Noah Martin Date: Thu, 10 Jul 2025 22:10:12 -0400 Subject: [PATCH] feat(v9): Remove profiling APIs deprecated in V9 --- .../SentrySDKOverrides.swift | 10 + .../SentrySampleShared/SentrySDKWrapper.swift | 2 + .../iOS-ObjectiveC/AppDelegate.m | 20 +- .../Profiling/ProfilingViewController.swift | 4 + .../Sentry/Profiling/SentryLaunchProfiling.m | 36 +- .../SentryProfiledTracerConcurrency.mm | 7 + .../Profiling/SentryProfilingSwiftHelpers.m | 2 + Sources/Sentry/Public/SentryOptions.h | 3 +- Sources/Sentry/SentryHub.m | 4 +- Sources/Sentry/SentryOptions.m | 53 +- Sources/Sentry/SentryProfiler.mm | 2 + Sources/Sentry/SentrySDK.m | 4 + Sources/Sentry/SentrySampling.m | 14 +- Sources/Sentry/SentrySpan.m | 12 +- .../Sentry/include/SentryLaunchProfiling.h | 2 + .../Sentry/include/SentryOptions+Private.h | 2 + .../include/SentryProfilingSwiftHelpers.h | 2 + Sources/Sentry/include/SentrySampling.h | 2 + .../Helper/SentryEnabledFeaturesBuilder.swift | 2 + sdk_api_V9.json | 519 ------------------ 20 files changed, 136 insertions(+), 566 deletions(-) diff --git a/Samples/SentrySampleShared/SentrySampleShared/SentrySDKOverrides.swift b/Samples/SentrySampleShared/SentrySampleShared/SentrySDKOverrides.swift index fff9e00d452..c73ac6ee1c9 100644 --- a/Samples/SentrySampleShared/SentrySampleShared/SentrySDKOverrides.swift +++ b/Samples/SentrySampleShared/SentrySampleShared/SentrySDKOverrides.swift @@ -133,8 +133,10 @@ public enum SentrySDKOverrides: String, CaseIterable { case tracing = "Tracing" public enum Profiling: String, SentrySDKOverride { + #if !SDK_V9 case sampleRate = "--io.sentry.profiling.profilesSampleRate" case samplerValue = "--io.sentry.profiling.profilesSamplerValue" + #endif // !SDK_V9 case disableAppStartProfiling = "--io.sentry.profiling.disable-app-start-profiling" case manualLifecycle = "--io.sentry.profiling.profile-lifecycle-manual" case sessionSampleRate = "--io.sentry.profiling.profile-session-sample-rate" @@ -238,7 +240,11 @@ private extension SentrySDKOverride { extension SentrySDKOverrides.Profiling { public var overrideType: OverrideType { switch self { + #if SDK_V9 + case .sessionSampleRate: return .float + #else case .sampleRate, .samplerValue, .sessionSampleRate: return .float + #endif // !SDK_V9 case .disableAppStartProfiling, .manualLifecycle, .disableUIProfiling, .slowLoadMethod, .immediateStop: return .boolean } } @@ -305,7 +311,11 @@ extension SentrySDKOverrides.Special { extension SentrySDKOverrides.Profiling { public var ignoresDisableEverything: Bool { switch self { + #if SDK_V9 + case .sessionSampleRate, .manualLifecycle, .slowLoadMethod, .immediateStop: return true + #else case .sampleRate, .samplerValue, .sessionSampleRate, .manualLifecycle, .slowLoadMethod, .immediateStop: return true + #endif // SDK_V9 case .disableAppStartProfiling, .disableUIProfiling: return false } } diff --git a/Samples/SentrySampleShared/SentrySampleShared/SentrySDKWrapper.swift b/Samples/SentrySampleShared/SentrySampleShared/SentrySDKWrapper.swift index 464370b8550..54378b69c70 100644 --- a/Samples/SentrySampleShared/SentrySampleShared/SentrySDKWrapper.swift +++ b/Samples/SentrySampleShared/SentrySampleShared/SentrySDKWrapper.swift @@ -425,6 +425,7 @@ extension SentrySDKWrapper { #if !os(tvOS) && !os(watchOS) && !os(visionOS) extension SentrySDKWrapper { func configureProfiling(_ options: Options) { + #if !SDK_V9 if let sampleRate = SentrySDKOverrides.Profiling.sampleRate.floatValue { options.profilesSampleRate = NSNumber(value: sampleRate) } @@ -434,6 +435,7 @@ extension SentrySDKWrapper { } } options.enableAppLaunchProfiling = !SentrySDKOverrides.Profiling.disableAppStartProfiling.boolValue + #endif // !SDK_V9 if !SentrySDKOverrides.Profiling.disableUIProfiling.boolValue { options.configureProfiling = { diff --git a/Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m b/Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m index a386ff30c1d..f035a516811 100644 --- a/Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m +++ b/Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m @@ -51,31 +51,33 @@ - (BOOL)application:(UIApplication *)application }; } +#if !SDK_V9 if (env[@"--io.sentry.profiling.profilesSampleRate"] != nil) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" options.profilesSampleRate = @([env[@"--io.sentry.profiling.profilesSampleRate"] floatValue]); -#pragma clang diagnostic pop +# pragma clang diagnostic pop } if (env[@"--io.sentry.profilesSamplerValue"] != nil) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" options.profilesSampler = ^NSNumber *_Nullable(SentrySamplingContext *_Nonnull samplingContext) { return @([env[@"--io.sentry.profilesSamplerValue"] floatValue]); }; -#pragma clang diagnostic pop +# pragma clang diagnostic pop } if (![args containsObject:@"--io.sentry.profiling.disable-app-start-profiling"]) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" options.enableAppLaunchProfiling = YES; -#pragma clang diagnostic pop +# pragma clang diagnostic pop } +#endif // !SDK_V9 SentryHttpStatusCodeRange *httpStatusCodeRange = [[SentryHttpStatusCodeRange alloc] initWithMin:400 max:599]; diff --git a/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift b/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift index 188dedfb80b..7b9aa1db14e 100644 --- a/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift @@ -59,8 +59,10 @@ class ProfilingViewController: UIViewController, UITextFieldDelegate { } @IBAction func sampleRateEdited(_ sender: UITextField) { + #if !SDK_V9 var sampleRate = SentrySDKOverrides.Profiling.sampleRate sampleRate.floatValue = getSampleRateOverride(field: sender) + #endif // !SDK_V9 } @IBAction func tracesSampleRateEdited(_ sender: UITextField) { @@ -76,8 +78,10 @@ class ProfilingViewController: UIViewController, UITextFieldDelegate { @IBAction func defineProfilesSampleRateToggled(_ sender: UISwitch) { sampleRateField.isEnabled = sender.isOn + #if !SDK_V9 var sampleRate = SentrySDKOverrides.Profiling.sampleRate sampleRate.floatValue = getSampleRateOverride(field: sampleRateField) + #endif // !SDK_V9 } @IBAction func defineTracesSampleRateToggled(_ sender: UISwitch) { diff --git a/Sources/Sentry/Profiling/SentryLaunchProfiling.m b/Sources/Sentry/Profiling/SentryLaunchProfiling.m index fc6a2b657dc..6fc6826a0cc 100644 --- a/Sources/Sentry/Profiling/SentryLaunchProfiling.m +++ b/Sources/Sentry/Profiling/SentryLaunchProfiling.m @@ -30,7 +30,9 @@ NSString *const kSentryLaunchProfileConfigKeyTracesSampleRand = @"traces.sample_rand"; NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRate = @"profiles"; NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRand = @"profiles.sample_rand"; +# if !SDK_V9 NSString *const kSentryLaunchProfileConfigKeyContinuousProfiling = @"continuous-profiling"; +# endif // !SDK_V9 NSString *const kSentryLaunchProfileConfigKeyContinuousProfilingV2 = @"continuous-profiling-v2-enabled"; NSString *const kSentryLaunchProfileConfigKeyContinuousProfilingV2Lifecycle @@ -161,11 +163,12 @@ configuration:tracerConfig]; } +# if !SDK_V9 SentryLaunchProfileDecision sentry_launchShouldHaveTransactionProfiling(SentryOptions *options) { -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated-declarations" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" BOOL shouldProfileNextLaunch = options.enableAppLaunchProfiling && options.enableTracing; if (!shouldProfileNextLaunch) { SENTRY_LOG_DEBUG(@"Specified options configuration doesn't enable launch profiling: " @@ -174,7 +177,7 @@ options.enableAppLaunchProfiling, options.enableTracing); return (SentryLaunchProfileDecision) { NO, nil, nil }; } -# pragma clang diagnostic pop +# pragma clang diagnostic pop SentryTransactionContext *transactionContext = [[SentryTransactionContext alloc] initWithName:@"app.launch" operation:@"profile"]; @@ -199,6 +202,7 @@ SENTRY_LOG_DEBUG(@"Will start transaction profile next launch; will profile launch."); return (SentryLaunchProfileDecision) { YES, tracesSamplerDecision, profilesSamplerDecision }; } +# endif // !SDK_V9 SentryLaunchProfileDecision sentry_launchShouldHaveContinuousProfilingV2(SentryOptions *options) @@ -261,15 +265,19 @@ if ([options isContinuousProfilingV2Enabled]) { return sentry_launchShouldHaveContinuousProfilingV2(options); } +# if SDK_V9 + return (SentryLaunchProfileDecision) { NO, nil, nil }; +# else -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated-declarations" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" if ([options isContinuousProfilingEnabled]) { return (SentryLaunchProfileDecision) { options.enableAppLaunchProfiling, nil, nil }; } -# pragma clang diagnostic pop +# pragma clang diagnostic pop return sentry_launchShouldHaveTransactionProfiling(options); +# endif // SDK_V9 } /** @@ -313,17 +321,21 @@ NSDictionary *persistedLaunchConfigOptionsDict = sentry_persistedLaunchProfileConfigurationOptions(); - BOOL isContinuousV1 = - [persistedLaunchConfigOptionsDict[kSentryLaunchProfileConfigKeyContinuousProfiling] - boolValue]; BOOL isContinuousV2 = [persistedLaunchConfigOptionsDict[kSentryLaunchProfileConfigKeyContinuousProfilingV2] boolValue]; +# if !SDK_V9 + BOOL isContinuousV1 = + [persistedLaunchConfigOptionsDict[kSentryLaunchProfileConfigKeyContinuousProfiling] + boolValue]; if (isContinuousV1 && isContinuousV2) { SENTRY_LOG_WARN(@"Launch profile misconfiguration detected."); _sentry_cleanUpConfigFile(); return; } +# else + BOOL isContinuousV1 = false; +# endif // !SDK_V9 SentrySamplerDecision *decision = _sentry_profileSampleDecision(persistedLaunchConfigOptionsDict); @@ -408,7 +420,9 @@ [NSMutableDictionary dictionary]; configDict[kSentryLaunchProfileConfigKeyWaitForFullDisplay] = @(options.enableTimeToFullDisplayTracing); +# if !SDK_V9 if ([options isContinuousProfilingEnabled]) { +# endif // !SDK_V9 if ([options isContinuousProfilingV2Enabled]) { SENTRY_LOG_DEBUG(@"Configuring continuous launch profile v2."); configDict[kSentryLaunchProfileConfigKeyContinuousProfilingV2] = @YES; @@ -425,9 +439,12 @@ configDict[kSentryLaunchProfileConfigKeyProfilesSampleRand] = config.profilesDecision.sampleRand; } else { +# if !SDK_V9 SENTRY_LOG_DEBUG(@"Configuring continuous launch profile."); configDict[kSentryLaunchProfileConfigKeyContinuousProfiling] = @YES; +# endif // !SDK_V9 } +# if !SDK_V9 } else { SENTRY_LOG_DEBUG(@"Configuring trace launch profile."); configDict[kSentryLaunchProfileConfigKeyTracesSampleRate] @@ -439,6 +456,7 @@ configDict[kSentryLaunchProfileConfigKeyProfilesSampleRand] = config.profilesDecision.sampleRand; } +# endif // !SDK_V9 writeAppLaunchProfilingConfigFile(configDict); }]; } diff --git a/Sources/Sentry/Profiling/SentryProfiledTracerConcurrency.mm b/Sources/Sentry/Profiling/SentryProfiledTracerConcurrency.mm index b87abb6fbed..79d8425efa0 100644 --- a/Sources/Sentry/Profiling/SentryProfiledTracerConcurrency.mm +++ b/Sources/Sentry/Profiling/SentryProfiledTracerConcurrency.mm @@ -177,10 +177,12 @@ sentry_stringFromSentryID(internalTraceId)); _unsafe_cleanUpContinuousProfilerV2(); } else if (internalTraceId != nil) { +# if !SDK_V9 if (sentry_isContinuousProfilingEnabled(hub.getClient)) { SENTRY_LOG_ERROR(@"Tracers are not tracked with continuous profiling V1."); return; } +# endif // !SDK_V9 if (_gTracersToProfilers == nil) { SENTRY_LOG_ERROR(@"Tracer to profiler should have already been initialized by the " @@ -351,8 +353,13 @@ } else { BOOL profileShouldBeSampled = configuration.profilesSamplerDecision.decision == kSentrySampleDecisionYes; +# if !SDK_V9 BOOL isContinuousProfiling = sentry_isContinuousProfilingEnabled(hub.client); BOOL shouldStartNormalTraceProfile = !isContinuousProfiling && profileShouldBeSampled; +# else + BOOL shouldStartNormalTraceProfile = profileShouldBeSampled; +# endif // !SDK_V9 + if (sentry_isTracingAppLaunch || shouldStartNormalTraceProfile) { SentryId *internalID = sentry_getSentryId(); if ([SentryTraceProfiler startWithTracer:internalID]) { diff --git a/Sources/Sentry/Profiling/SentryProfilingSwiftHelpers.m b/Sources/Sentry/Profiling/SentryProfilingSwiftHelpers.m index 162ff71d5a3..1e846c5ef48 100644 --- a/Sources/Sentry/Profiling/SentryProfilingSwiftHelpers.m +++ b/Sources/Sentry/Profiling/SentryProfilingSwiftHelpers.m @@ -8,11 +8,13 @@ # import "SentrySamplerDecision.h" # import "SentrySwift.h" +# if !SDK_V9 BOOL sentry_isContinuousProfilingEnabled(SentryClient *client) { return [client.options isContinuousProfilingEnabled]; } +# endif // !SDK_V9 BOOL sentry_isContinuousProfilingV2Enabled(SentryClient *client) diff --git a/Sources/Sentry/Public/SentryOptions.h b/Sources/Sentry/Public/SentryOptions.h index d4c56f1a04e..e1134e38635 100644 --- a/Sources/Sentry/Public/SentryOptions.h +++ b/Sources/Sentry/Public/SentryOptions.h @@ -530,6 +530,7 @@ typedef void (^SentryProfilingConfigurationBlock)(SentryProfileOptions *_Nonnull */ @property (nullable, nonatomic, copy) SentryProfilingConfigurationBlock configureProfiling; +# if !SDK_V9 /** * @warning This is an experimental feature and may still have bugs. * Set to @c YES to run the profiler as early as possible in an app launch, before you would @@ -592,7 +593,6 @@ typedef void (^SentryProfilingConfigurationBlock)(SentryProfileOptions *_Nonnull SentryTracesSamplerCallback profilesSampler NS_SWIFT_SENDABLE DEPRECATED_MSG_ATTRIBUTE( "This property is deprecated and will be removed in a future version of the SDK. See " "SentryProfileOptions.sessionSampleRate"); -; /** * If profiling should be enabled or not. @@ -620,6 +620,7 @@ typedef void (^SentryProfilingConfigurationBlock)(SentryProfileOptions *_Nonnull @property (nonatomic, assign) BOOL enableProfiling DEPRECATED_MSG_ATTRIBUTE( "Use profilesSampleRate or profilesSampler instead. This property will be removed in a future " "version of the SDK"); +# endif // !SDK_V9 #endif // SENTRY_TARGET_PROFILING_SUPPORTED /** diff --git a/Sources/Sentry/SentryHub.m b/Sources/Sentry/SentryHub.m index f2ec986940c..548fd5c734c 100644 --- a/Sources/Sentry/SentryHub.m +++ b/Sources/Sentry/SentryHub.m @@ -464,13 +464,13 @@ - (SentryTracer *)startTransactionWithContext:(SentryTransactionContext *)transa sampleRate:tracesSamplerDecision.sampleRate sampleRand:tracesSamplerDecision.sampleRand]; -#if SENTRY_TARGET_PROFILING_SUPPORTED +#if SENTRY_TARGET_PROFILING_SUPPORTED && !SDK_V9 if (![self.client.options isContinuousProfilingEnabled]) { SentrySamplerDecision *profilesSamplerDecision = sentry_sampleTraceProfile( samplingContext, tracesSamplerDecision, self.client.options); configuration.profilesSamplerDecision = profilesSamplerDecision; } -#endif // SENTRY_TARGET_PROFILING_SUPPORTED" +#endif // SENTRY_TARGET_PROFILING_SUPPORTED && !SDK_V9 SentryTracer *tracer = [[SentryTracer alloc] initWithTransactionContext:transactionContext hub:self diff --git a/Sources/Sentry/SentryOptions.m b/Sources/Sentry/SentryOptions.m index 4590c8a094c..5229e93315e 100644 --- a/Sources/Sentry/SentryOptions.m +++ b/Sources/Sentry/SentryOptions.m @@ -154,11 +154,13 @@ - (instancetype)init self.enableNetworkBreadcrumbs = YES; self.tracesSampleRate = nil; #if SENTRY_TARGET_PROFILING_SUPPORTED +# if !SDK_V9 _enableProfiling = NO; -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated-declarations" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" self.profilesSampleRate = SENTRY_INITIAL_PROFILES_SAMPLE_RATE; -# pragma clang diagnostic pop +# pragma clang diagnostic pop +# endif // !SDK_V9 #endif // SENTRY_TARGET_PROFILING_SUPPORTED self.enableCoreDataTracing = YES; _enableSwizzling = YES; @@ -544,25 +546,27 @@ - (BOOL)validateOptions:(NSDictionary *)options block:^(BOOL value) { self->_enableCoreDataTracing = value; }]; #if SENTRY_TARGET_PROFILING_SUPPORTED +# if !SDK_V9 if ([options[@"profilesSampleRate"] isKindOfClass:[NSNumber class]]) { -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated-declarations" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" self.profilesSampleRate = options[@"profilesSampleRate"]; -# pragma clang diagnostic pop +# pragma clang diagnostic pop } -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated-declarations" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" if ([self isBlock:options[@"profilesSampler"]]) { self.profilesSampler = options[@"profilesSampler"]; } -# pragma clang diagnostic pop +# pragma clang diagnostic pop [self setBool:options[@"enableProfiling"] block:^(BOOL value) { self->_enableProfiling = value; }]; [self setBool:options[NSStringFromSelector(@selector(enableAppLaunchProfiling))] block:^(BOOL value) { self->_enableAppLaunchProfiling = value; }]; +# endif // !SDK_V9 #endif // SENTRY_TARGET_PROFILING_SUPPORTED [self setBool:options[@"sendClientReports"] @@ -685,6 +689,7 @@ - (BOOL)isTracingEnabled } #if SENTRY_TARGET_PROFILING_SUPPORTED +# if !SDK_V9 - (void)setProfilesSampleRate:(NSNumber *)profilesSampleRate { if (profilesSampleRate == nil) { @@ -704,41 +709,53 @@ - (BOOL)isProfilingEnabled - (BOOL)isContinuousProfilingEnabled { -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated-declarations" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" // this looks a little weird with the `!self.enableProfiling` but that actually is the // deprecated way to say "enable trace-based profiling", which necessarily disables continuous // profiling as they are mutually exclusive modes return _profilesSampleRate == nil && _profilesSampler == nil && !self.enableProfiling; -# pragma clang diagnostic pop +# pragma clang diagnostic pop } +# endif // !SDK_V9 + - (BOOL)isContinuousProfilingV2Enabled { +# if SDK_V9 + return _profiling != nil; +# else return [self isContinuousProfilingEnabled] && _profiling != nil; +# endif // SDK_V9 } - (BOOL)isProfilingCorrelatedToTraces { +# if SDK_V9 + return _profiling != nil && _profiling.lifecycle == SentryProfileLifecycleTrace; +# else return ![self isContinuousProfilingEnabled] || (_profiling != nil && _profiling.lifecycle == SentryProfileLifecycleTrace); +# endif // SDK_V9 } +# if !SDK_V9 - (void)setEnableProfiling_DEPRECATED_TEST_ONLY:(BOOL)enableProfiling_DEPRECATED_TEST_ONLY { -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated-declarations" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" self.enableProfiling = enableProfiling_DEPRECATED_TEST_ONLY; -# pragma clang diagnostic pop +# pragma clang diagnostic pop } - (BOOL)enableProfiling_DEPRECATED_TEST_ONLY { -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated-declarations" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" return self.enableProfiling; -# pragma clang diagnostic pop +# pragma clang diagnostic pop } +# endif // !SDK_V9 #endif // SENTRY_TARGET_PROFILING_SUPPORTED /** diff --git a/Sources/Sentry/SentryProfiler.mm b/Sources/Sentry/SentryProfiler.mm index b3ab263d23f..efe086a7691 100644 --- a/Sources/Sentry/SentryProfiler.mm +++ b/Sources/Sentry/SentryProfiler.mm @@ -68,6 +68,7 @@ void sentry_configureContinuousProfiling(SentryOptions *options) { +# if !SDK_V9 if (![options isContinuousProfilingEnabled]) { if (options.configureProfiling != nil) { SENTRY_LOG_WARN(@"In order to configure SentryProfileOptions you must remove " @@ -76,6 +77,7 @@ } return; } +# endif // !SDK_V9 if (options.configureProfiling == nil) { SENTRY_LOG_DEBUG(@"Continuous profiling V2 configuration not set by SDK consumer, nothing " diff --git a/Sources/Sentry/SentrySDK.m b/Sources/Sentry/SentrySDK.m index ef080dc41ab..1407c3fb220 100644 --- a/Sources/Sentry/SentrySDK.m +++ b/Sources/Sentry/SentrySDK.m @@ -676,6 +676,7 @@ + (void)crash + (void)startProfiler { SentryOptions *options = currentHub.client.options; +# if !SDK_V9 if (![options isContinuousProfilingEnabled]) { SENTRY_LOG_WARN( @"You must disable trace profiling by setting SentryOptions.profilesSampleRate and " @@ -685,6 +686,7 @@ + (void)startProfiler @"relies on deprecated options and will change in a future version."); return; } +# endif // !SDK_V9 if (options.profiling != nil) { if (options.profiling.lifecycle == SentryProfileLifecycleTrace) { @@ -742,6 +744,7 @@ + (void)stopProfiler } SentryOptions *options = currentHub.client.options; +# if !SDK_V9 if (![options isContinuousProfilingEnabled]) { SENTRY_LOG_WARN( @"You must disable trace profiling by setting SentryOptions.profilesSampleRate and " @@ -751,6 +754,7 @@ + (void)stopProfiler @"relies on deprecated options and will change in a future version."); return; } +# endif // !SDK_V9 if (options.profiling != nil && options.profiling.lifecycle == SentryProfileLifecycleTrace) { SENTRY_LOG_WARN( diff --git a/Sources/Sentry/SentrySampling.m b/Sources/Sentry/SentrySampling.m index 5c2ac44c0a5..c3a2785a17e 100644 --- a/Sources/Sentry/SentrySampling.m +++ b/Sources/Sentry/SentrySampling.m @@ -87,6 +87,7 @@ #if SENTRY_TARGET_PROFILING_SUPPORTED +# if !SDK_V9 SentrySamplerDecision * sentry_sampleTraceProfile(SentrySamplingContext *context, SentrySamplerDecision *tracesSamplerDecision, SentryOptions *options) @@ -101,8 +102,8 @@ } // Backward compatibility for clients that are still using the enableProfiling option. -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated-declarations" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" if (options.enableProfiling) { return [[SentrySamplerDecision alloc] initWithDecision:kSentrySampleDecisionYes forSampleRate:@1.0 @@ -111,16 +112,17 @@ NSNumber *callbackRate = _sentry_samplerCallbackRate( options.profilesSampler, context, SENTRY_DEFAULT_PROFILES_SAMPLE_RATE); -# pragma clang diagnostic pop +# pragma clang diagnostic pop if (callbackRate != nil) { return _sentry_calcSample(callbackRate); } -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated-declarations" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated-declarations" return _sentry_calcSampleFromNumericalRate(options.profilesSampleRate); -# pragma clang diagnostic pop +# pragma clang diagnostic pop } +# endif // !SDK_V9 SentrySamplerDecision * sentry_sampleProfileSession(float sessionSampleRate) diff --git a/Sources/Sentry/SentrySpan.m b/Sources/Sentry/SentrySpan.m index 11c91f1584a..a91335f885e 100644 --- a/Sources/Sentry/SentrySpan.m +++ b/Sources/Sentry/SentrySpan.m @@ -49,9 +49,9 @@ @implementation SentrySpan { SentryFramesTracker *_framesTracker; #endif // SENTRY_HAS_UIKIT -#if SENTRY_TARGET_PROFILING_SUPPORTED +#if SENTRY_TARGET_PROFILING_SUPPORTED && !SDK_V9 BOOL _isContinuousProfiling; -#endif // SENTRY_TARGET_PROFILING_SUPPORTED +#endif // SENTRY_TARGET_PROFILING_SUPPORTED && !SDK_V9 } - (instancetype)initWithContext:(SentrySpanContext *)context @@ -98,8 +98,10 @@ - (instancetype)initWithContext:(SentrySpanContext *)context _origin = context.origin; #if SENTRY_TARGET_PROFILING_SUPPORTED +# if !SDK_V9 _isContinuousProfiling = [SentrySDK.options isContinuousProfilingEnabled]; if (_isContinuousProfiling) { +# endif // !SDK_V9 _profileSessionID = SentryContinuousProfiler.currentProfilerID.sentryIdString; if (_profileSessionID == nil) { [SentryDependencyContainer.sharedInstance.notificationCenterWrapper @@ -108,7 +110,9 @@ - (instancetype)initWithContext:(SentrySpanContext *)context name:kSentryNotificationContinuousProfileStarted object:nil]; } +# if !SDK_V9 } +# endif // !SDK_V9 #endif // SENTRY_TARGET_PROFILING_SUPPORTED } @@ -135,12 +139,16 @@ - (void)linkProfiler - (void)stopObservingContinuousProfiling { +# if !SDK_V9 if (_isContinuousProfiling) { +# endif // !SDK_V9 [SentryDependencyContainer.sharedInstance.notificationCenterWrapper removeObserver:self name:kSentryNotificationContinuousProfileStarted object:nil]; +# if !SDK_V9 } +# endif // !SDK_V9 } #endif // SENTRY_TARGET_PROFILING_SUPPORTED diff --git a/Sources/Sentry/include/SentryLaunchProfiling.h b/Sources/Sentry/include/SentryLaunchProfiling.h index db1e0428ed2..99b73a173bf 100644 --- a/Sources/Sentry/include/SentryLaunchProfiling.h +++ b/Sources/Sentry/include/SentryLaunchProfiling.h @@ -18,7 +18,9 @@ SENTRY_EXTERN NSString *const kSentryLaunchProfileConfigKeyTracesSampleRate; SENTRY_EXTERN NSString *const kSentryLaunchProfileConfigKeyTracesSampleRand; SENTRY_EXTERN NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRate; SENTRY_EXTERN NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRand; +# if !SDK_V9 SENTRY_EXTERN NSString *const kSentryLaunchProfileConfigKeyContinuousProfiling; +# endif // !SDK_V9 SENTRY_EXTERN NSString *const kSentryLaunchProfileConfigKeyContinuousProfilingV2; SENTRY_EXTERN NSString *const kSentryLaunchProfileConfigKeyContinuousProfilingV2Lifecycle; SENTRY_EXTERN NSString *const kSentryLaunchProfileConfigKeyWaitForFullDisplay; diff --git a/Sources/Sentry/include/SentryOptions+Private.h b/Sources/Sentry/include/SentryOptions+Private.h index aedcf8383be..d0eb72dbd84 100644 --- a/Sources/Sentry/include/SentryOptions+Private.h +++ b/Sources/Sentry/include/SentryOptions+Private.h @@ -12,11 +12,13 @@ FOUNDATION_EXPORT NSString *const kSentryDefaultEnvironment; #if SENTRY_TARGET_PROFILING_SUPPORTED @property (nonatomic, assign) BOOL enableProfiling_DEPRECATED_TEST_ONLY; +# if !SDK_V9 /** * If continuous profiling mode v1 ("beta") is enabled. * @note Not for use with launch profiles. See functions in @c SentryLaunchProfiling . */ - (BOOL)isContinuousProfilingEnabled; +# endif // !SDK_V9 /** * If UI profiling mode ("continuous v2") is enabled. diff --git a/Sources/Sentry/include/SentryProfilingSwiftHelpers.h b/Sources/Sentry/include/SentryProfilingSwiftHelpers.h index a7ae0a41c7a..57760b4a51d 100644 --- a/Sources/Sentry/include/SentryProfilingSwiftHelpers.h +++ b/Sources/Sentry/include/SentryProfilingSwiftHelpers.h @@ -18,7 +18,9 @@ NS_ASSUME_NONNULL_BEGIN extern "C" { #endif +#if !SDK_V9 BOOL sentry_isContinuousProfilingEnabled(SentryClient *client); +#endif // !SDK_V9 BOOL sentry_isContinuousProfilingV2Enabled(SentryClient *client); BOOL sentry_isProfilingCorrelatedToTraces(SentryClient *client); SentryProfileOptions *sentry_getProfiling(SentryClient *client); diff --git a/Sources/Sentry/include/SentrySampling.h b/Sources/Sentry/include/SentrySampling.h index 469d2a339b2..97742fe8e87 100644 --- a/Sources/Sentry/include/SentrySampling.h +++ b/Sources/Sentry/include/SentrySampling.h @@ -19,8 +19,10 @@ SENTRY_EXTERN SentrySamplerDecision *sentry_sampleTrace( * whether the trace corresponding to the profile was sampled, to decide whether to configure the * next launch to start a trace profile. */ +# if !SDK_V9 SENTRY_EXTERN SentrySamplerDecision *sentry_sampleTraceProfile(SentrySamplingContext *context, SentrySamplerDecision *tracesSamplerDecision, SentryOptions *options); +# endif // !SDK_V9 SENTRY_EXTERN SentrySamplerDecision *sentry_sampleProfileSession(float sessionSampleRate); #endif // SENTRY_TARGET_PROFILING_SUPPORTED diff --git a/Sources/Swift/Helper/SentryEnabledFeaturesBuilder.swift b/Sources/Swift/Helper/SentryEnabledFeaturesBuilder.swift index 2c822d2266f..060f74b25a0 100644 --- a/Sources/Swift/Helper/SentryEnabledFeaturesBuilder.swift +++ b/Sources/Swift/Helper/SentryEnabledFeaturesBuilder.swift @@ -23,9 +23,11 @@ import Foundation } #if os(iOS) || os(macOS) || targetEnvironment(macCatalyst) + #if !SDK_V9 if options.enableAppLaunchProfiling { features.append("appLaunchProfiling") } + #endif // !SDK_V9 #endif // os(iOS) || os(macOS) || targetEnvironment(macCatalyst) #if os(iOS) || os(tvOS) diff --git a/sdk_api_V9.json b/sdk_api_V9.json index 468adac1138..c051f9b97dc 100644 --- a/sdk_api_V9.json +++ b/sdk_api_V9.json @@ -19459,525 +19459,6 @@ } ] }, - { - "kind": "Var", - "name": "enableAppLaunchProfiling", - "printedName": "enableAppLaunchProfiling", - "children": [ - { - "kind": "TypeNominal", - "name": "Bool", - "printedName": "Swift.Bool", - "usr": "s:Sb" - } - ], - "declKind": "Var", - "usr": "c:objc(cs)SentryOptions(py)enableAppLaunchProfiling", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "enableAppLaunchProfiling", - "declAttributes": [ - "Available", - "ObjC", - "Dynamic" - ], - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ - { - "kind": "TypeNominal", - "name": "Bool", - "printedName": "Swift.Bool", - "usr": "s:Sb" - } - ], - "declKind": "Accessor", - "usr": "c:objc(cs)SentryOptions(im)enableAppLaunchProfiling", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "enableAppLaunchProfiling", - "declAttributes": [ - "DiscardableResult", - "Available", - "ObjC", - "Dynamic" - ], - "accessorKind": "get" - }, - { - "kind": "Accessor", - "name": "Set", - "printedName": "Set()", - "children": [ - { - "kind": "TypeNameAlias", - "name": "Void", - "printedName": "Swift.Void", - "children": [ - { - "kind": "TypeNominal", - "name": "Void", - "printedName": "()" - } - ] - }, - { - "kind": "TypeNominal", - "name": "Bool", - "printedName": "Swift.Bool", - "usr": "s:Sb" - } - ], - "declKind": "Accessor", - "usr": "c:objc(cs)SentryOptions(im)setEnableAppLaunchProfiling:", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "setEnableAppLaunchProfiling:", - "declAttributes": [ - "Available", - "ObjC", - "Dynamic" - ], - "accessorKind": "set" - } - ] - }, - { - "kind": "Var", - "name": "profilesSampleRate", - "printedName": "profilesSampleRate", - "children": [ - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "Foundation.NSNumber?", - "children": [ - { - "kind": "TypeNominal", - "name": "NSNumber", - "printedName": "Foundation.NSNumber", - "usr": "c:objc(cs)NSNumber" - } - ], - "usr": "s:Sq" - } - ], - "declKind": "Var", - "usr": "c:objc(cs)SentryOptions(py)profilesSampleRate", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "profilesSampleRate", - "declAttributes": [ - "Available", - "ObjC", - "Dynamic" - ], - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "Foundation.NSNumber?", - "children": [ - { - "kind": "TypeNominal", - "name": "NSNumber", - "printedName": "Foundation.NSNumber", - "usr": "c:objc(cs)NSNumber" - } - ], - "usr": "s:Sq" - } - ], - "declKind": "Accessor", - "usr": "c:objc(cs)SentryOptions(im)profilesSampleRate", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "profilesSampleRate", - "declAttributes": [ - "DiscardableResult", - "Available", - "ObjC", - "Dynamic" - ], - "accessorKind": "get" - }, - { - "kind": "Accessor", - "name": "Set", - "printedName": "Set()", - "children": [ - { - "kind": "TypeNameAlias", - "name": "Void", - "printedName": "Swift.Void", - "children": [ - { - "kind": "TypeNominal", - "name": "Void", - "printedName": "()" - } - ] - }, - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "Foundation.NSNumber?", - "children": [ - { - "kind": "TypeNominal", - "name": "NSNumber", - "printedName": "Foundation.NSNumber", - "usr": "c:objc(cs)NSNumber" - } - ], - "usr": "s:Sq" - } - ], - "declKind": "Accessor", - "usr": "c:objc(cs)SentryOptions(im)setProfilesSampleRate:", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "setProfilesSampleRate:", - "declAttributes": [ - "Available", - "ObjC", - "Dynamic" - ], - "accessorKind": "set" - } - ] - }, - { - "kind": "Var", - "name": "profilesSampler", - "printedName": "profilesSampler", - "children": [ - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "((Sentry.SamplingContext) -> Foundation.NSNumber?)?", - "children": [ - { - "kind": "TypeFunc", - "name": "Function", - "printedName": "(Sentry.SamplingContext) -> Foundation.NSNumber?", - "children": [ - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "Foundation.NSNumber?", - "children": [ - { - "kind": "TypeNominal", - "name": "NSNumber", - "printedName": "Foundation.NSNumber", - "usr": "c:objc(cs)NSNumber" - } - ], - "usr": "s:Sq" - }, - { - "kind": "TypeNominal", - "name": "SamplingContext", - "printedName": "Sentry.SamplingContext", - "usr": "c:objc(cs)SentrySamplingContext" - } - ] - } - ], - "usr": "s:Sq" - } - ], - "declKind": "Var", - "usr": "c:objc(cs)SentryOptions(py)profilesSampler", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "profilesSampler", - "declAttributes": [ - "Available", - "ObjC", - "Dynamic" - ], - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "((Sentry.SamplingContext) -> Foundation.NSNumber?)?", - "children": [ - { - "kind": "TypeFunc", - "name": "Function", - "printedName": "(Sentry.SamplingContext) -> Foundation.NSNumber?", - "children": [ - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "Foundation.NSNumber?", - "children": [ - { - "kind": "TypeNominal", - "name": "NSNumber", - "printedName": "Foundation.NSNumber", - "usr": "c:objc(cs)NSNumber" - } - ], - "usr": "s:Sq" - }, - { - "kind": "TypeNominal", - "name": "SamplingContext", - "printedName": "Sentry.SamplingContext", - "usr": "c:objc(cs)SentrySamplingContext" - } - ] - } - ], - "usr": "s:Sq" - } - ], - "declKind": "Accessor", - "usr": "c:objc(cs)SentryOptions(im)profilesSampler", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "profilesSampler", - "declAttributes": [ - "DiscardableResult", - "Available", - "ObjC", - "Dynamic" - ], - "accessorKind": "get" - }, - { - "kind": "Accessor", - "name": "Set", - "printedName": "Set()", - "children": [ - { - "kind": "TypeNameAlias", - "name": "Void", - "printedName": "Swift.Void", - "children": [ - { - "kind": "TypeNominal", - "name": "Void", - "printedName": "()" - } - ] - }, - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "((Sentry.SamplingContext) -> Foundation.NSNumber?)?", - "children": [ - { - "kind": "TypeFunc", - "name": "Function", - "printedName": "(Sentry.SamplingContext) -> Foundation.NSNumber?", - "children": [ - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "Foundation.NSNumber?", - "children": [ - { - "kind": "TypeNominal", - "name": "NSNumber", - "printedName": "Foundation.NSNumber", - "usr": "c:objc(cs)NSNumber" - } - ], - "usr": "s:Sq" - }, - { - "kind": "TypeNominal", - "name": "SamplingContext", - "printedName": "Sentry.SamplingContext", - "usr": "c:objc(cs)SentrySamplingContext" - } - ] - } - ], - "usr": "s:Sq" - } - ], - "declKind": "Accessor", - "usr": "c:objc(cs)SentryOptions(im)setProfilesSampler:", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "setProfilesSampler:", - "declAttributes": [ - "Available", - "ObjC", - "Dynamic" - ], - "accessorKind": "set" - } - ] - }, - { - "kind": "Var", - "name": "isProfilingEnabled", - "printedName": "isProfilingEnabled", - "children": [ - { - "kind": "TypeNominal", - "name": "Bool", - "printedName": "Swift.Bool", - "usr": "s:Sb" - } - ], - "declKind": "Var", - "usr": "c:objc(cs)SentryOptions(py)isProfilingEnabled", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "isProfilingEnabled", - "declAttributes": [ - "Available", - "ObjC", - "Dynamic" - ], - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ - { - "kind": "TypeNominal", - "name": "Bool", - "printedName": "Swift.Bool", - "usr": "s:Sb" - } - ], - "declKind": "Accessor", - "usr": "c:objc(cs)SentryOptions(im)isProfilingEnabled", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "isProfilingEnabled", - "declAttributes": [ - "DiscardableResult", - "Available", - "ObjC", - "Dynamic" - ], - "accessorKind": "get" - } - ] - }, - { - "kind": "Var", - "name": "enableProfiling", - "printedName": "enableProfiling", - "children": [ - { - "kind": "TypeNominal", - "name": "Bool", - "printedName": "Swift.Bool", - "usr": "s:Sb" - } - ], - "declKind": "Var", - "usr": "c:objc(cs)SentryOptions(py)enableProfiling", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "enableProfiling", - "declAttributes": [ - "Available", - "ObjC", - "Dynamic" - ], - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ - { - "kind": "TypeNominal", - "name": "Bool", - "printedName": "Swift.Bool", - "usr": "s:Sb" - } - ], - "declKind": "Accessor", - "usr": "c:objc(cs)SentryOptions(im)enableProfiling", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "enableProfiling", - "declAttributes": [ - "DiscardableResult", - "Available", - "ObjC", - "Dynamic" - ], - "accessorKind": "get" - }, - { - "kind": "Accessor", - "name": "Set", - "printedName": "Set()", - "children": [ - { - "kind": "TypeNameAlias", - "name": "Void", - "printedName": "Swift.Void", - "children": [ - { - "kind": "TypeNominal", - "name": "Void", - "printedName": "()" - } - ] - }, - { - "kind": "TypeNominal", - "name": "Bool", - "printedName": "Swift.Bool", - "usr": "s:Sb" - } - ], - "declKind": "Accessor", - "usr": "c:objc(cs)SentryOptions(im)setEnableProfiling:", - "moduleName": "Sentry", - "deprecated": true, - "isOpen": true, - "objc_name": "setEnableProfiling:", - "declAttributes": [ - "Available", - "ObjC", - "Dynamic" - ], - "accessorKind": "set" - } - ] - }, { "kind": "Var", "name": "sendClientReports",