Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Removes unused SentryLogLevel (#5591)
- Removes deprecated `setExtraValue` from SentrySpan (#5864)
- Removes deprecated getStoreEndpoint (#5591)
- Remove legacy profiling, the only supported profiling is now what was known as continuous V2 (#6386)
- Removes deprecated useSpan function (#5591)
- Removes deprecated user feedback API, this is replaced with the new feedback API (#5591)
- Removes `enablePerformanceV2` option and makes this the default. The app start duration will now finish when the first frame is drawn instead of when the OS posts the UIWindowDidBecomeVisibleNotification. (#6008)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ 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"
Expand Down Expand Up @@ -266,11 +262,7 @@ 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
}
}
Expand Down Expand Up @@ -363,11 +355,7 @@ 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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,17 +469,6 @@ 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)
}
if let samplerValue = SentrySDKOverrides.Profiling.samplerValue.floatValue {
options.profilesSampler = { _ in
return NSNumber(value: samplerValue)
}
}
#endif // !SDK_V9

if !SentrySDKOverrides.Profiling.disableUIProfiling.boolValue {
options.configureProfiling = {
$0.lifecycle = SentrySDKOverrides.Profiling.manualLifecycle.boolValue ? .manual : .trace
Expand Down
21 changes: 0 additions & 21 deletions Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,6 @@ - (BOOL)application:(UIApplication *)application
};
}

#if !SDK_V9
if (env[@"--io.sentry.profiling.profilesSampleRate"] != nil) {
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
options.profilesSampleRate =
@([env[@"--io.sentry.profiling.profilesSampleRate"] floatValue]);
# pragma clang diagnostic pop
}

if (env[@"--io.sentry.profilesSamplerValue"] != nil) {
# 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
}
#endif // !SDK_V9

SentryHttpStatusCodeRange *httpStatusCodeRange =
[[SentryHttpStatusCodeRange alloc] initWithMin:400 max:599];
options.failedRequestStatusCodes = @[ httpStatusCodeRange ];
Expand Down
39 changes: 0 additions & 39 deletions Samples/iOS-Swift/iOS-Swift-UITests/ProfilingUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,6 @@ class ProfilingUITests: BaseUITest {

try performTest(lifecycle: .manual)
}

/**
* 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.
*/
func testProfilingGPUInfo() throws {
if #available(iOS 16, *) {
app.launchArguments.append(contentsOf: [
SentrySDKOverrides.Special.wipeDataOnLaunch.rawValue,

// we're only interested in the manual transaction, the automatic stuff messes up how we try to retrieve the target profile info
SentrySDKOverrides.Other.disableSwizzling.rawValue,

SentrySDKOverrides.Profiling.disableAppStartProfiling.rawValue
])
app.launchEnvironment[SentrySDKOverrides.Profiling.sampleRate.rawValue] = "1.0"
launchApp()

goToTransactions()
startTransaction()

app.buttons["appHangFullyBlockingThreadSleeping"].afterWaitingForExistence("Couldn't find button to trigger fully blocking AppHang.").tap()
stopTransaction()

goToProfiling()
retrieveLastProfileData()
let profileDict = try marshalJSONDictionaryFromApp()

let metrics = try XCTUnwrap(profileDict["measurements"] as? [String: Any])
// We can only be sure about frozen frames when triggering an ANR.
// It could be that there is no slow frame for the captured transaction.
let frozenFrames = try XCTUnwrap(metrics["frozen_frame_renders"] as? [String: Any])
let frozenFrameValues = try XCTUnwrap(frozenFrames["values"] as? [[String: Any]])
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.")

let frameRates = try XCTUnwrap(metrics["screen_frame_rates"] as? [String: Any])
let frameRateValues = try XCTUnwrap(frameRates["values"] as? [[String: Any]])
XCTAssertFalse(frameRateValues.isEmpty)
}
}
}

extension ProfilingUITests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ 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) {
Expand All @@ -77,11 +73,6 @@ 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) {
Expand Down Expand Up @@ -169,18 +160,6 @@ private extension ProfilingViewController {
func optionsConfiguration() {
guard let options = SentrySDKInternal.currentHub().getClient()?.options else { return }

#if !SDK_V9
if let sampleRate = options.profilesSampleRate {
sampleRateField.text = String(format: "%.2f", sampleRate.floatValue)
sampleRateField.isEnabled = true
profilesSampleRateSwitch.isOn = true
} else {
sampleRateField.isEnabled = false
sampleRateField.text = "nil"
profilesSampleRateSwitch.isOn = false
}
#endif // !SDK_V9

if let sampleRate = options.tracesSampleRate {
tracesSampleRateField.text = String(format: "%.2f", sampleRate.floatValue)
tracesSampleRateField.isEnabled = true
Expand Down
4 changes: 0 additions & 4 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,6 @@
8431EFD329B27B1100D8DC56 /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = 630C01951EC341D600C52CEF /* Resources */; };
8431EFDC29B27B5300D8DC56 /* SentryProfilerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 03F9D37B2819A65C00602916 /* SentryProfilerTests.mm */; };
8431EFDD29B27B5300D8DC56 /* SentrySamplingProfilerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 035E73CB27D575B3005EEB11 /* SentrySamplingProfilerTests.mm */; };
8431EFDE29B27B5300D8DC56 /* SentryTraceProfilerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8419C0C328C1889D001C8259 /* SentryTraceProfilerTests.swift */; };
8431EFDF29B27B5300D8DC56 /* SentryThreadHandleTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 035E73C927D57398005EEB11 /* SentryThreadHandleTests.mm */; };
8431EFE029B27B5300D8DC56 /* SentryBacktraceTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 035E73C727D56757005EEB11 /* SentryBacktraceTests.mm */; };
8431EFE129B27B5300D8DC56 /* SentryThreadMetadataCacheTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 035E73CD27D5790A005EEB11 /* SentryThreadMetadataCacheTests.mm */; };
Expand Down Expand Up @@ -1898,7 +1897,6 @@
840B7EF22BBF83DF008B8120 /* SentryProfiler+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryProfiler+Private.h"; path = "Sources/Sentry/include/SentryProfiler+Private.h"; sourceTree = SOURCE_ROOT; };
841325C42BF49EC40029228F /* SentryLaunchProfiling+Tests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SentryLaunchProfiling+Tests.h"; sourceTree = "<group>"; };
841325DE2BFED0510029228F /* TestFramesTracker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestFramesTracker.swift; sourceTree = "<group>"; };
8419C0C328C1889D001C8259 /* SentryTraceProfilerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryTraceProfilerTests.swift; sourceTree = "<group>"; };
84281C422A578E5600EE88F2 /* SentryProfilerState.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SentryProfilerState.mm; sourceTree = "<group>"; };
84281C442A57905700EE88F2 /* SentrySample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySample.h; path = ../include/SentrySample.h; sourceTree = "<group>"; };
84281C452A57905700EE88F2 /* SentrySample.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySample.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4018,7 +4016,6 @@
845CEB162D8A979700B6B325 /* SentryAppStartProfilingConfigurationTests.swift */,
84A898CD2E1DBDD1009A551E /* SentryAppStartProfilingConfigurationChangeTests.swift */,
845CEAEE2D83F79500B6B325 /* SentryProfilingPublicAPITests.swift */,
8419C0C328C1889D001C8259 /* SentryTraceProfilerTests.swift */,
8446F5182BE172290040D57E /* SentryContinuousProfilerTests.swift */,
8431D4522BE1741E009EAEC1 /* SentryProfileTestFixture.swift */,
);
Expand Down Expand Up @@ -6449,7 +6446,6 @@
84F2A1CE2E06001300A94524 /* (null) in Sources */,
845CEB172D8A979700B6B325 /* SentryAppStartProfilingConfigurationTests.swift in Sources */,
8431EFE529B27BAD00D8DC56 /* SentryNSProcessInfoWrapperTests.swift in Sources */,
8431EFDE29B27B5300D8DC56 /* SentryTraceProfilerTests.swift in Sources */,
84A898CE2E1DBDD1009A551E /* SentryAppStartProfilingConfigurationChangeTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
81 changes: 14 additions & 67 deletions Sources/Sentry/Profiling/SentryLaunchProfiling.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
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
Expand Down Expand Up @@ -83,15 +80,6 @@
profileOptions:profileOptions];
}

void
_sentry_continuousProfilingV1_startLaunchProfile(BOOL shouldWaitForFullDisplay)
{
sentry_profileConfiguration =
[[SentryProfileConfiguration alloc] initWaitingForFullDisplay:shouldWaitForFullDisplay
continuousV1:YES];
[SentryContinuousProfiler start];
}

/**
* Hydrate any relevant launch profiling options persisted from the previous launch and start a
* trace that will automatically start a manual lifecycle continuous profile (v2)
Expand Down Expand Up @@ -162,7 +150,7 @@
}

SentryLaunchProfileDecision
sentry_launchShouldHaveContinuousProfilingV2(SentryOptions *options)
sentry_launchShouldHaveContinuousProfiling(SentryOptions *options)
{
if (!options.profiling.profileAppStarts) {
SENTRY_LOG_DEBUG(@"Continuous profiling v2 enabled but disabled app start profiling, "
Expand Down Expand Up @@ -219,8 +207,8 @@
SentryLaunchProfileDecision
sentry_shouldProfileNextLaunch(SentryOptions *options)
{
if ([options isContinuousProfilingV2Enabled]) {
return sentry_launchShouldHaveContinuousProfilingV2(options);
if ([options isContinuousProfilingEnabled]) {
return sentry_launchShouldHaveContinuousProfiling(options);
}
return (SentryLaunchProfileDecision) { NO, nil, nil };
}
Expand Down Expand Up @@ -269,22 +257,10 @@
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);
if (!isContinuousV1 && nil == decision) {
if (nil == decision) {
SENTRY_LOG_DEBUG(@"Couldn't hydrate the persisted sample decision.");
_sentry_cleanUpConfigFile();
return;
Expand All @@ -302,13 +278,6 @@

BOOL shouldWaitForFullDisplay = shouldWaitForFullDisplayValue.boolValue;

if (isContinuousV1) {
SENTRY_LOG_DEBUG(@"Starting continuous launch profile v1.");
_sentry_continuousProfilingV1_startLaunchProfile(shouldWaitForFullDisplay);
_sentry_cleanUpConfigFile();
return;
}

SentryProfileOptions *profileOptions = nil;
if (isContinuousV2) {
SENTRY_LOG_DEBUG(@"Starting continuous launch profile v2.");
Expand Down Expand Up @@ -336,8 +305,7 @@
SentryProfileLifecycleTrace, shouldWaitForFullDisplay);
} else {
sentry_profileConfiguration =
[[SentryProfileConfiguration alloc] initWaitingForFullDisplay:shouldWaitForFullDisplay
continuousV1:NO];
[[SentryProfileConfiguration alloc] initWaitingForFullDisplay:shouldWaitForFullDisplay];
}

// trace lifecycle UI profiling (continuous profiling v2) and trace-based profiling both join
Expand Down Expand Up @@ -365,43 +333,22 @@
[NSMutableDictionary<NSString *, NSNumber *> 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;
configDict[kSentryLaunchProfileConfigKeyContinuousProfilingV2Lifecycle] =
@(options.profiling.lifecycle);
if (options.profiling.lifecycle == SentryProfileLifecycleTrace) {
configDict[kSentryLaunchProfileConfigKeyTracesSampleRate]
= config.tracesDecision.sampleRate;
configDict[kSentryLaunchProfileConfigKeyTracesSampleRand]
= config.tracesDecision.sampleRand;
}
configDict[kSentryLaunchProfileConfigKeyProfilesSampleRate]
= config.profilesDecision.sampleRate;
configDict[kSentryLaunchProfileConfigKeyProfilesSampleRand]
= config.profilesDecision.sampleRand;
} else {
# if !SDK_V9
SENTRY_LOG_DEBUG(@"Configuring continuous launch profile.");
configDict[kSentryLaunchProfileConfigKeyContinuousProfiling] = @YES;
# endif // !SDK_V9
SENTRY_LOG_DEBUG(@"Configuring continuous launch profile v2.");
configDict[kSentryLaunchProfileConfigKeyContinuousProfilingV2] = @YES;
configDict[kSentryLaunchProfileConfigKeyContinuousProfilingV2Lifecycle] =
@(options.profiling.lifecycle);
if (options.profiling.lifecycle == SentryProfileLifecycleTrace) {
configDict[kSentryLaunchProfileConfigKeyTracesSampleRate]
= config.tracesDecision.sampleRate;
configDict[kSentryLaunchProfileConfigKeyTracesSampleRand]
= config.tracesDecision.sampleRand;
}
# if !SDK_V9
} else {
SENTRY_LOG_DEBUG(@"Configuring trace launch profile.");
configDict[kSentryLaunchProfileConfigKeyTracesSampleRate]
= config.tracesDecision.sampleRate;
configDict[kSentryLaunchProfileConfigKeyTracesSampleRand]
= config.tracesDecision.sampleRand;
configDict[kSentryLaunchProfileConfigKeyProfilesSampleRate]
= config.profilesDecision.sampleRate;
configDict[kSentryLaunchProfileConfigKeyProfilesSampleRand]
= config.profilesDecision.sampleRand;
}
# endif // !SDK_V9
writeAppLaunchProfilingConfigFile(configDict);
}];
}
Expand Down
4 changes: 1 addition & 3 deletions Sources/Sentry/Profiling/SentryProfileConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ - (instancetype)initWithProfileOptions:(SentryProfileOptions *)options
}

- (instancetype)initWaitingForFullDisplay:(BOOL)shouldWaitForFullDisplay
continuousV1:(BOOL)continuousV1
{
if (!(self = [super init])) {
return nil;
}

_waitForFullDisplay = shouldWaitForFullDisplay;
_isContinuousV1 = continuousV1;
_isProfilingThisLaunch = YES;
return self;
}
Expand All @@ -39,7 +37,7 @@ - (instancetype)initContinuousProfilingV2WaitingForFullDisplay:(BOOL)shouldWaitF
samplerDecision:(SentrySamplerDecision *)decision
profileOptions:(SentryProfileOptions *)options
{
if (!(self = [self initWaitingForFullDisplay:shouldWaitForFullDisplay continuousV1:NO])) {
if (!(self = [self initWaitingForFullDisplay:shouldWaitForFullDisplay])) {
return nil;
}

Expand Down
Loading
Loading