Skip to content

Commit

Permalink
add logs and bails based on lifecycle option
Browse files Browse the repository at this point in the history
  • Loading branch information
armcknight committed Feb 18, 2025
1 parent 024479f commit 922ee10
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Sources/Sentry/SentrySDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -637,14 +637,24 @@ + (void)startProfileSession

// TODO: log a debug message and bail if the profile session is not sampled

// TODO: log a debug message and bail if SentryOptions.profileLifecycle is set to trace
if (currentHub.client.options.profiling.lifecycle == LifecycleTrace) {
SENTRY_LOG_WARN(
@"The profiling lifecycle is set to trace, so you cannot start profile sessions "
@"manually. See SentryProfilingOptions.Lifecycle for more information.");
return;
}

[SentryContinuousProfiler start];
}

+ (void)stopProfileSession
{
// TODO: log a debug message and bail if SentryOptions.profileLifecycle is set to trace
if (currentHub.client.options.profiling.lifecycle == LifecycleTrace) {
SENTRY_LOG_WARN(
@"The profiling lifecycle is set to trace, so you cannot stop profile sessions "
@"manually. See SentryProfilingOptions.Lifecycle for more information.");
return;
}

[SentryContinuousProfiler stop];
}
Expand Down

0 comments on commit 922ee10

Please sign in to comment.