Skip to content

Commit ffc2038

Browse files
committed
better comments
1 parent 1241510 commit ffc2038

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/browser/src/tracing/browserTracingIntegration.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,9 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
276276
addPerformanceEntries(span, { recordClsOnPageloadSpan: !enableStandaloneClsSpans });
277277
setActiveIdleSpan(client, undefined);
278278

279-
// A trace should to stay the consistent over the entire time span of one route.
280-
// Therefore, we update the traceId/sampled properties on the propagation context.
281-
// When a navigation happens, this is overwritten
279+
// A trace should stay consistent over the entire timespan of one route - even after the pageload/navigation ended.
280+
// Only when another navigation happens, we want to create a new trace.
281+
// This way, e.g. errors that occur after the pageload span ended are still associated to the pageload trace.
282282
const scope = getCurrentScope();
283283
const oldPropagationContext = scope.getPropagationContext();
284284

@@ -444,7 +444,6 @@ export function startBrowserTracingPageLoadSpan(
444444
* This will only do something if a browser tracing integration has been setup.
445445
*/
446446
export function startBrowserTracingNavigationSpan(client: Client, spanOptions: StartSpanOptions): Span | undefined {
447-
// Reset this to ensure we start a new trace, instead of continuing the last pageload/navigation trace
448447
getIsolationScope().setPropagationContext({ traceId: generateTraceId(), sampleRand: Math.random() });
449448
getCurrentScope().setPropagationContext({ traceId: generateTraceId(), sampleRand: Math.random() });
450449

0 commit comments

Comments
 (0)