Skip to content

Commit

Permalink
feat: collect timings on profiler stop calls (#8409)
Browse files Browse the repository at this point in the history
Collect span information on how long the async calls to profiler.stop
take which will help us evaluate if calling txn.finish after
profiler.stop is a viable approach
  • Loading branch information
JonasBa committed Jun 27, 2023
1 parent ac435dd commit 88eb034
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 0 additions & 4 deletions packages/browser/src/profiling/cache.ts

This file was deleted.

7 changes: 7 additions & 0 deletions packages/browser/src/profiling/hubextensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,15 @@ export function wrapTransactionWithProfiling(transaction: Transaction): Transact
return null;
}

// This is temporary - we will use the collected span data to evaluate
// if deferring txn.finish until profiler resolves is a viable approach.
const stopProfilerSpan = transaction.startChild({ description: 'profiler.stop', op: 'profiler' });

return profiler
.stop()
.then((p: JSSelfProfile): null => {
stopProfilerSpan.finish();

if (maxDurationTimeoutID) {
WINDOW.clearTimeout(maxDurationTimeoutID);
maxDurationTimeoutID = undefined;
Expand All @@ -199,6 +205,7 @@ export function wrapTransactionWithProfiling(transaction: Transaction): Transact
return null;
})
.catch(error => {
stopProfilerSpan.finish();
if (__DEBUG_BUILD__) {
logger.log('[Profiling] error while stopping profiler:', error);
}
Expand Down

0 comments on commit 88eb034

Please sign in to comment.