Skip to content

Commit

Permalink
continuous profiler doesn't stop anymore when an error occurs, but co…
Browse files Browse the repository at this point in the history
…ntinue scheduling restart
  • Loading branch information
stefanosiano committed Nov 12, 2024
1 parent cc5a048 commit 3c9a35a
Showing 1 changed file with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,18 @@ private synchronized void stop(final boolean restartProfiler) {

// check if profiler end successfully
if (endData == null) {
// A problem occurred. Profile chunk is not captured. Let's reset ids.
chunkId = SentryId.EMPTY_ID;
profilerId = SentryId.EMPTY_ID;
return;
}

// The scopes can be null if the profiler is started before the SDK is initialized (app start
// profiling), meaning there's no scopes to send the chunks. In that case, we store the data
// in a list and send it when the next chunk is finished.
synchronized (payloadBuilders) {
payloadBuilders.add(
new ProfileChunk.Builder(
profilerId, chunkId, endData.measurementsMap, endData.traceFile));
logger.log(
SentryLevel.ERROR,
"An error occurred while collecting a profile chunk, and it won't be sent.");
} else {
// The scopes can be null if the profiler is started before the SDK is initialized (app start
// profiling), meaning there's no scopes to send the chunks. In that case, we store the data
// in a list and send it when the next chunk is finished.
synchronized (payloadBuilders) {
payloadBuilders.add(
new ProfileChunk.Builder(
profilerId, chunkId, endData.measurementsMap, endData.traceFile));
}
}

isRunning = false;
Expand Down

0 comments on commit 3c9a35a

Please sign in to comment.