Skip to content
Draft
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
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 @@ -588,7 +588,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 @@ -1904,7 +1903,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 @@ -4021,7 +4019,6 @@
845CEB162D8A979700B6B325 /* SentryAppStartProfilingConfigurationTests.swift */,
84A898CD2E1DBDD1009A551E /* SentryAppStartProfilingConfigurationChangeTests.swift */,
845CEAEE2D83F79500B6B325 /* SentryProfilingPublicAPITests.swift */,
8419C0C328C1889D001C8259 /* SentryTraceProfilerTests.swift */,
8446F5182BE172290040D57E /* SentryContinuousProfilerTests.swift */,
8431D4522BE1741E009EAEC1 /* SentryProfileTestFixture.swift */,
);
Expand Down Expand Up @@ -6451,7 +6448,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
41 changes: 10 additions & 31 deletions Sources/Sentry/Profiling/SentryLaunchProfiling.m
Original file line number Diff line number Diff line change
Expand Up @@ -366,43 +366,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
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;
}
# 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
22 changes: 2 additions & 20 deletions Sources/Sentry/Profiling/SentryProfiledTracerConcurrency.mm
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,6 @@
sentry_stringFromSentryID(internalTraceId));
_unsafe_cleanUpContinuousProfilerV2();
} else if (internalTraceId != nil) {
# if !SDK_V9
SentryClient *_Nullable client = hub.getClient;
if (client == nil) {
SENTRY_LOG_ERROR(@"No client found, skipping cleanup.");
return;
}
if (sentry_isContinuousProfilingEnabled(SENTRY_UNWRAP_NULLABLE(SentryClient, client))) {
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 "
Expand Down Expand Up @@ -372,15 +361,8 @@
}
BOOL profileShouldBeSampled
= configuration.profilesSamplerDecision.decision == kSentrySampleDecisionYes;
# if !SDK_V9
BOOL isContinuousProfiling = client != nil
&& sentry_isContinuousProfilingEnabled(SENTRY_UNWRAP_NULLABLE(SentryClient, client));
BOOL shouldStartNormalTraceProfile = !isContinuousProfiling && profileShouldBeSampled;
# else
BOOL shouldStartNormalTraceProfile = profileShouldBeSampled;
# endif // !SDK_V9

if (sentry_isTracingAppLaunch || shouldStartNormalTraceProfile) {

if (sentry_isTracingAppLaunch || profileShouldBeSampled) {
SentryId *internalID = sentry_getSentryId();
if ([SentryTraceProfiler startWithTracer:internalID]) {
SENTRY_LOG_DEBUG(@"Started profiler for trace %@ with internal id %@",
Expand Down
8 changes: 0 additions & 8 deletions Sources/Sentry/Profiling/SentryProfilingSwiftHelpers.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
# 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)
{
Expand Down
Loading
Loading