Skip to content

Commit 22af3fc

Browse files
authored
chore: Remove profiling API deprecated in V9 (#6386)
* chore: Remove profiling API deprecated in V9 * WIP * PR feedback
1 parent b7b4358 commit 22af3fc

34 files changed

+106
-3095
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Removes unused SentryLogLevel (#5591)
1111
- Removes deprecated `setExtraValue` from SentrySpan (#5864)
1212
- Removes deprecated getStoreEndpoint (#5591)
13+
- Remove legacy profiling, the only supported profiling is now what was known as continuous V2 (#6386)
1314
- Removes deprecated useSpan function (#5591)
1415
- The `span` property on `SentryScope` is now readonly (#5866)
1516
- Removes deprecated SentryDebugImageProvider class (#5598)

Samples/SentrySampleShared/SentrySampleShared/SentrySDKOverrides.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ public enum SentrySDKOverrides: String, CaseIterable {
159159
case tracing = "Tracing"
160160

161161
public enum Profiling: String, SentrySDKOverride {
162-
#if !SDK_V9
163-
case sampleRate = "--io.sentry.profiling.profilesSampleRate"
164-
case samplerValue = "--io.sentry.profiling.profilesSamplerValue"
165-
#endif // !SDK_V9
166162
case disableAppStartProfiling = "--io.sentry.profiling.disable-app-start-profiling"
167163
case manualLifecycle = "--io.sentry.profiling.profile-lifecycle-manual"
168164
case sessionSampleRate = "--io.sentry.profiling.profile-session-sample-rate"
@@ -266,11 +262,7 @@ private extension SentrySDKOverride {
266262
extension SentrySDKOverrides.Profiling {
267263
public var overrideType: OverrideType {
268264
switch self {
269-
#if SDK_V9
270265
case .sessionSampleRate: return .float
271-
#else
272-
case .sampleRate, .samplerValue, .sessionSampleRate: return .float
273-
#endif // !SDK_V9
274266
case .disableAppStartProfiling, .manualLifecycle, .disableUIProfiling, .slowLoadMethod, .immediateStop: return .boolean
275267
}
276268
}
@@ -363,11 +355,7 @@ extension SentrySDKOverrides.Special {
363355
extension SentrySDKOverrides.Profiling {
364356
public var ignoresDisableEverything: Bool {
365357
switch self {
366-
#if SDK_V9
367358
case .sessionSampleRate, .manualLifecycle, .slowLoadMethod, .immediateStop: return true
368-
#else
369-
case .sampleRate, .samplerValue, .sessionSampleRate, .manualLifecycle, .slowLoadMethod, .immediateStop: return true
370-
#endif // SDK_V9
371359
case .disableAppStartProfiling, .disableUIProfiling: return false
372360
}
373361
}

Samples/SentrySampleShared/SentrySampleShared/SentrySDKWrapper.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -469,17 +469,6 @@ extension SentrySDKWrapper {
469469
#if !os(tvOS) && !os(watchOS) && !os(visionOS)
470470
extension SentrySDKWrapper {
471471
func configureProfiling(_ options: Options) {
472-
#if !SDK_V9
473-
if let sampleRate = SentrySDKOverrides.Profiling.sampleRate.floatValue {
474-
options.profilesSampleRate = NSNumber(value: sampleRate)
475-
}
476-
if let samplerValue = SentrySDKOverrides.Profiling.samplerValue.floatValue {
477-
options.profilesSampler = { _ in
478-
return NSNumber(value: samplerValue)
479-
}
480-
}
481-
#endif // !SDK_V9
482-
483472
if !SentrySDKOverrides.Profiling.disableUIProfiling.boolValue {
484473
options.configureProfiling = {
485474
$0.lifecycle = SentrySDKOverrides.Profiling.manualLifecycle.boolValue ? .manual : .trace

Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,6 @@ - (BOOL)application:(UIApplication *)application
5151
};
5252
}
5353

54-
#if !SDK_V9
55-
if (env[@"--io.sentry.profiling.profilesSampleRate"] != nil) {
56-
# pragma clang diagnostic push
57-
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
58-
options.profilesSampleRate =
59-
@([env[@"--io.sentry.profiling.profilesSampleRate"] floatValue]);
60-
# pragma clang diagnostic pop
61-
}
62-
63-
if (env[@"--io.sentry.profilesSamplerValue"] != nil) {
64-
# pragma clang diagnostic push
65-
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
66-
options.profilesSampler
67-
= ^NSNumber *_Nullable(SentrySamplingContext *_Nonnull samplingContext)
68-
{
69-
return @([env[@"--io.sentry.profilesSamplerValue"] floatValue]);
70-
};
71-
# pragma clang diagnostic pop
72-
}
73-
#endif // !SDK_V9
74-
7554
SentryHttpStatusCodeRange *httpStatusCodeRange =
7655
[[SentryHttpStatusCodeRange alloc] initWithMin:400 max:599];
7756
options.failedRequestStatusCodes = @[ httpStatusCodeRange ];

Samples/iOS-Swift/iOS-Swift-UITests/ProfilingUITests.swift

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,45 +22,6 @@ class ProfilingUITests: BaseUITest {
2222

2323
try performTest(lifecycle: .manual)
2424
}
25-
26-
/**
27-
* We had a bug where we forgot to install the frames tracker into the profiler, so weren't sending any GPU frame information with profiles. Since it's not possible to enforce such installation via the compiler, we test for the results we expect here, by starting a transaction, triggering an ANR which will cause degraded frame rendering, stop the transaction, and inspect the profile payload.
28-
*/
29-
func testProfilingGPUInfo() throws {
30-
if #available(iOS 16, *) {
31-
app.launchArguments.append(contentsOf: [
32-
SentrySDKOverrides.Special.wipeDataOnLaunch.rawValue,
33-
34-
// we're only interested in the manual transaction, the automatic stuff messes up how we try to retrieve the target profile info
35-
SentrySDKOverrides.Other.disableSwizzling.rawValue,
36-
37-
SentrySDKOverrides.Profiling.disableAppStartProfiling.rawValue
38-
])
39-
app.launchEnvironment[SentrySDKOverrides.Profiling.sampleRate.rawValue] = "1.0"
40-
launchApp()
41-
42-
goToTransactions()
43-
startTransaction()
44-
45-
app.buttons["appHangFullyBlockingThreadSleeping"].afterWaitingForExistence("Couldn't find button to trigger fully blocking AppHang.").tap()
46-
stopTransaction()
47-
48-
goToProfiling()
49-
retrieveLastProfileData()
50-
let profileDict = try marshalJSONDictionaryFromApp()
51-
52-
let metrics = try XCTUnwrap(profileDict["measurements"] as? [String: Any])
53-
// We can only be sure about frozen frames when triggering an ANR.
54-
// It could be that there is no slow frame for the captured transaction.
55-
let frozenFrames = try XCTUnwrap(metrics["frozen_frame_renders"] as? [String: Any])
56-
let frozenFrameValues = try XCTUnwrap(frozenFrames["values"] as? [[String: Any]])
57-
XCTAssertFalse(frozenFrameValues.isEmpty, "The test triggered an ANR while the transaction is running. There must be at least one frozen frame, but there was none.")
58-
59-
let frameRates = try XCTUnwrap(metrics["screen_frame_rates"] as? [String: Any])
60-
let frameRateValues = try XCTUnwrap(frameRates["values"] as? [[String: Any]])
61-
XCTAssertFalse(frameRateValues.isEmpty)
62-
}
63-
}
6425
}
6526

6627
extension ProfilingUITests {

Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ class ProfilingViewController: UIViewController, UITextFieldDelegate {
5959
}
6060

6161
@IBAction func sampleRateEdited(_ sender: UITextField) {
62-
#if !SDK_V9
63-
var sampleRate = SentrySDKOverrides.Profiling.sampleRate
64-
sampleRate.floatValue = getSampleRateOverride(field: sender)
65-
#endif // !SDK_V9
6662
}
6763

6864
@IBAction func tracesSampleRateEdited(_ sender: UITextField) {
@@ -77,11 +73,6 @@ class ProfilingViewController: UIViewController, UITextFieldDelegate {
7773

7874
@IBAction func defineProfilesSampleRateToggled(_ sender: UISwitch) {
7975
sampleRateField.isEnabled = sender.isOn
80-
81-
#if !SDK_V9
82-
var sampleRate = SentrySDKOverrides.Profiling.sampleRate
83-
sampleRate.floatValue = getSampleRateOverride(field: sampleRateField)
84-
#endif // !SDK_V9
8576
}
8677

8778
@IBAction func defineTracesSampleRateToggled(_ sender: UISwitch) {
@@ -169,18 +160,6 @@ private extension ProfilingViewController {
169160
func optionsConfiguration() {
170161
guard let options = SentrySDKInternal.currentHub().getClient()?.options else { return }
171162

172-
#if !SDK_V9
173-
if let sampleRate = options.profilesSampleRate {
174-
sampleRateField.text = String(format: "%.2f", sampleRate.floatValue)
175-
sampleRateField.isEnabled = true
176-
profilesSampleRateSwitch.isOn = true
177-
} else {
178-
sampleRateField.isEnabled = false
179-
sampleRateField.text = "nil"
180-
profilesSampleRateSwitch.isOn = false
181-
}
182-
#endif // !SDK_V9
183-
184163
if let sampleRate = options.tracesSampleRate {
185164
tracesSampleRateField.text = String(format: "%.2f", sampleRate.floatValue)
186165
tracesSampleRateField.isEnabled = true

Sentry.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@
581581
8431EFD329B27B1100D8DC56 /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = 630C01951EC341D600C52CEF /* Resources */; };
582582
8431EFDC29B27B5300D8DC56 /* SentryProfilerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 03F9D37B2819A65C00602916 /* SentryProfilerTests.mm */; };
583583
8431EFDD29B27B5300D8DC56 /* SentrySamplingProfilerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 035E73CB27D575B3005EEB11 /* SentrySamplingProfilerTests.mm */; };
584-
8431EFDE29B27B5300D8DC56 /* SentryTraceProfilerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8419C0C328C1889D001C8259 /* SentryTraceProfilerTests.swift */; };
585584
8431EFDF29B27B5300D8DC56 /* SentryThreadHandleTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 035E73C927D57398005EEB11 /* SentryThreadHandleTests.mm */; };
586585
8431EFE029B27B5300D8DC56 /* SentryBacktraceTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 035E73C727D56757005EEB11 /* SentryBacktraceTests.mm */; };
587586
8431EFE129B27B5300D8DC56 /* SentryThreadMetadataCacheTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 035E73CD27D5790A005EEB11 /* SentryThreadMetadataCacheTests.mm */; };
@@ -1898,7 +1897,6 @@
18981897
840B7EF22BBF83DF008B8120 /* SentryProfiler+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryProfiler+Private.h"; path = "Sources/Sentry/include/SentryProfiler+Private.h"; sourceTree = SOURCE_ROOT; };
18991898
841325C42BF49EC40029228F /* SentryLaunchProfiling+Tests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SentryLaunchProfiling+Tests.h"; sourceTree = "<group>"; };
19001899
841325DE2BFED0510029228F /* TestFramesTracker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestFramesTracker.swift; sourceTree = "<group>"; };
1901-
8419C0C328C1889D001C8259 /* SentryTraceProfilerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryTraceProfilerTests.swift; sourceTree = "<group>"; };
19021900
84281C422A578E5600EE88F2 /* SentryProfilerState.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SentryProfilerState.mm; sourceTree = "<group>"; };
19031901
84281C442A57905700EE88F2 /* SentrySample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySample.h; path = ../include/SentrySample.h; sourceTree = "<group>"; };
19041902
84281C452A57905700EE88F2 /* SentrySample.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySample.m; sourceTree = "<group>"; };
@@ -4019,7 +4017,6 @@
40194017
845CEB162D8A979700B6B325 /* SentryAppStartProfilingConfigurationTests.swift */,
40204018
84A898CD2E1DBDD1009A551E /* SentryAppStartProfilingConfigurationChangeTests.swift */,
40214019
845CEAEE2D83F79500B6B325 /* SentryProfilingPublicAPITests.swift */,
4022-
8419C0C328C1889D001C8259 /* SentryTraceProfilerTests.swift */,
40234020
8446F5182BE172290040D57E /* SentryContinuousProfilerTests.swift */,
40244021
8431D4522BE1741E009EAEC1 /* SentryProfileTestFixture.swift */,
40254022
);
@@ -6451,7 +6448,6 @@
64516448
84F2A1CE2E06001300A94524 /* (null) in Sources */,
64526449
845CEB172D8A979700B6B325 /* SentryAppStartProfilingConfigurationTests.swift in Sources */,
64536450
8431EFE529B27BAD00D8DC56 /* SentryNSProcessInfoWrapperTests.swift in Sources */,
6454-
8431EFDE29B27B5300D8DC56 /* SentryTraceProfilerTests.swift in Sources */,
64556451
84A898CE2E1DBDD1009A551E /* SentryAppStartProfilingConfigurationChangeTests.swift in Sources */,
64566452
);
64576453
runOnlyForDeploymentPostprocessing = 0;

Sources/Sentry/Profiling/SentryLaunchProfiling.m

Lines changed: 14 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
NSString *const kSentryLaunchProfileConfigKeyTracesSampleRand = @"traces.sample_rand";
2929
NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRate = @"profiles";
3030
NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRand = @"profiles.sample_rand";
31-
# if !SDK_V9
32-
NSString *const kSentryLaunchProfileConfigKeyContinuousProfiling = @"continuous-profiling";
33-
# endif // !SDK_V9
3431
NSString *const kSentryLaunchProfileConfigKeyContinuousProfilingV2
3532
= @"continuous-profiling-v2-enabled";
3633
NSString *const kSentryLaunchProfileConfigKeyContinuousProfilingV2Lifecycle
@@ -83,15 +80,6 @@
8380
profileOptions:profileOptions];
8481
}
8582

86-
void
87-
_sentry_continuousProfilingV1_startLaunchProfile(BOOL shouldWaitForFullDisplay)
88-
{
89-
sentry_profileConfiguration =
90-
[[SentryProfileConfiguration alloc] initWaitingForFullDisplay:shouldWaitForFullDisplay
91-
continuousV1:YES];
92-
[SentryContinuousProfiler start];
93-
}
94-
9583
/**
9684
* Hydrate any relevant launch profiling options persisted from the previous launch and start a
9785
* trace that will automatically start a manual lifecycle continuous profile (v2)
@@ -162,7 +150,7 @@
162150
}
163151

164152
SentryLaunchProfileDecision
165-
sentry_launchShouldHaveContinuousProfilingV2(SentryOptions *options)
153+
sentry_launchShouldHaveContinuousProfiling(SentryOptions *options)
166154
{
167155
if (!options.profiling.profileAppStarts) {
168156
SENTRY_LOG_DEBUG(@"Continuous profiling v2 enabled but disabled app start profiling, "
@@ -219,8 +207,8 @@
219207
SentryLaunchProfileDecision
220208
sentry_shouldProfileNextLaunch(SentryOptions *options)
221209
{
222-
if ([options isContinuousProfilingV2Enabled]) {
223-
return sentry_launchShouldHaveContinuousProfilingV2(options);
210+
if ([options isContinuousProfilingEnabled]) {
211+
return sentry_launchShouldHaveContinuousProfiling(options);
224212
}
225213
return (SentryLaunchProfileDecision) { NO, nil, nil };
226214
}
@@ -269,22 +257,10 @@
269257
BOOL isContinuousV2 =
270258
[persistedLaunchConfigOptionsDict[kSentryLaunchProfileConfigKeyContinuousProfilingV2]
271259
boolValue];
272-
# if !SDK_V9
273-
BOOL isContinuousV1 =
274-
[persistedLaunchConfigOptionsDict[kSentryLaunchProfileConfigKeyContinuousProfiling]
275-
boolValue];
276-
if (isContinuousV1 && isContinuousV2) {
277-
SENTRY_LOG_WARN(@"Launch profile misconfiguration detected.");
278-
_sentry_cleanUpConfigFile();
279-
return;
280-
}
281-
# else
282-
BOOL isContinuousV1 = false;
283-
# endif // !SDK_V9
284260

285261
SentrySamplerDecision *decision
286262
= _sentry_profileSampleDecision(persistedLaunchConfigOptionsDict);
287-
if (!isContinuousV1 && nil == decision) {
263+
if (nil == decision) {
288264
SENTRY_LOG_DEBUG(@"Couldn't hydrate the persisted sample decision.");
289265
_sentry_cleanUpConfigFile();
290266
return;
@@ -302,13 +278,6 @@
302278

303279
BOOL shouldWaitForFullDisplay = shouldWaitForFullDisplayValue.boolValue;
304280

305-
if (isContinuousV1) {
306-
SENTRY_LOG_DEBUG(@"Starting continuous launch profile v1.");
307-
_sentry_continuousProfilingV1_startLaunchProfile(shouldWaitForFullDisplay);
308-
_sentry_cleanUpConfigFile();
309-
return;
310-
}
311-
312281
SentryProfileOptions *profileOptions = nil;
313282
if (isContinuousV2) {
314283
SENTRY_LOG_DEBUG(@"Starting continuous launch profile v2.");
@@ -336,8 +305,7 @@
336305
SentryProfileLifecycleTrace, shouldWaitForFullDisplay);
337306
} else {
338307
sentry_profileConfiguration =
339-
[[SentryProfileConfiguration alloc] initWaitingForFullDisplay:shouldWaitForFullDisplay
340-
continuousV1:NO];
308+
[[SentryProfileConfiguration alloc] initWaitingForFullDisplay:shouldWaitForFullDisplay];
341309
}
342310

343311
// trace lifecycle UI profiling (continuous profiling v2) and trace-based profiling both join
@@ -365,43 +333,22 @@
365333
[NSMutableDictionary<NSString *, NSNumber *> dictionary];
366334
configDict[kSentryLaunchProfileConfigKeyWaitForFullDisplay] =
367335
@(options.enableTimeToFullDisplayTracing);
368-
# if !SDK_V9
369336
if ([options isContinuousProfilingEnabled]) {
370-
# endif // !SDK_V9
371-
if ([options isContinuousProfilingV2Enabled]) {
372-
SENTRY_LOG_DEBUG(@"Configuring continuous launch profile v2.");
373-
configDict[kSentryLaunchProfileConfigKeyContinuousProfilingV2] = @YES;
374-
configDict[kSentryLaunchProfileConfigKeyContinuousProfilingV2Lifecycle] =
375-
@(options.profiling.lifecycle);
376-
if (options.profiling.lifecycle == SentryProfileLifecycleTrace) {
377-
configDict[kSentryLaunchProfileConfigKeyTracesSampleRate]
378-
= config.tracesDecision.sampleRate;
379-
configDict[kSentryLaunchProfileConfigKeyTracesSampleRand]
380-
= config.tracesDecision.sampleRand;
381-
}
382-
configDict[kSentryLaunchProfileConfigKeyProfilesSampleRate]
383-
= config.profilesDecision.sampleRate;
384-
configDict[kSentryLaunchProfileConfigKeyProfilesSampleRand]
385-
= config.profilesDecision.sampleRand;
386-
} else {
387-
# if !SDK_V9
388-
SENTRY_LOG_DEBUG(@"Configuring continuous launch profile.");
389-
configDict[kSentryLaunchProfileConfigKeyContinuousProfiling] = @YES;
390-
# endif // !SDK_V9
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;
391346
}
392-
# if !SDK_V9
393-
} else {
394-
SENTRY_LOG_DEBUG(@"Configuring trace launch profile.");
395-
configDict[kSentryLaunchProfileConfigKeyTracesSampleRate]
396-
= config.tracesDecision.sampleRate;
397-
configDict[kSentryLaunchProfileConfigKeyTracesSampleRand]
398-
= config.tracesDecision.sampleRand;
399347
configDict[kSentryLaunchProfileConfigKeyProfilesSampleRate]
400348
= config.profilesDecision.sampleRate;
401349
configDict[kSentryLaunchProfileConfigKeyProfilesSampleRand]
402350
= config.profilesDecision.sampleRand;
403351
}
404-
# endif // !SDK_V9
405352
writeAppLaunchProfilingConfigFile(configDict);
406353
}];
407354
}

Sources/Sentry/Profiling/SentryProfileConfiguration.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ - (instancetype)initWithProfileOptions:(SentryProfileOptions *)options
2323
}
2424

2525
- (instancetype)initWaitingForFullDisplay:(BOOL)shouldWaitForFullDisplay
26-
continuousV1:(BOOL)continuousV1
2726
{
2827
if (!(self = [super init])) {
2928
return nil;
3029
}
3130

3231
_waitForFullDisplay = shouldWaitForFullDisplay;
33-
_isContinuousV1 = continuousV1;
3432
_isProfilingThisLaunch = YES;
3533
return self;
3634
}
@@ -39,7 +37,7 @@ - (instancetype)initContinuousProfilingV2WaitingForFullDisplay:(BOOL)shouldWaitF
3937
samplerDecision:(SentrySamplerDecision *)decision
4038
profileOptions:(SentryProfileOptions *)options
4139
{
42-
if (!(self = [self initWaitingForFullDisplay:shouldWaitForFullDisplay continuousV1:NO])) {
40+
if (!(self = [self initWaitingForFullDisplay:shouldWaitForFullDisplay])) {
4341
return nil;
4442
}
4543

0 commit comments

Comments
 (0)