Skip to content

Commit 6a5946f

Browse files
committed
add new redirect condition to LCP/CLS spans
1 parent ed3c762 commit 6a5946f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

packages/browser/src/tracing/browserTracingIntegration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ export function startBrowserTracingNavigationSpan(
657657
options?: { url?: string; isRedirect?: boolean },
658658
): Span | undefined {
659659
const { url, isRedirect } = options || {};
660-
client.emit('beforeStartNavigationSpan', spanOptions);
660+
client.emit('beforeStartNavigationSpan', spanOptions, { isRedirect });
661661
client.emit('startNavigationSpan', spanOptions, { isRedirect });
662662

663663
const scope = getCurrentScope();

packages/core/src/client.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,10 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
607607
* A hook for triggering right before a navigation span is started.
608608
* @returns {() => void} A function that, when executed, removes the registered callback.
609609
*/
610-
public on(hook: 'beforeStartNavigationSpan', callback: (options: StartSpanOptions) => void): () => void;
610+
public on(
611+
hook: 'beforeStartNavigationSpan',
612+
callback: (options: StartSpanOptions, navigationOptions?: { isRedirect?: boolean }) => void,
613+
): () => void;
611614

612615
/**
613616
* A hook for browser tracing integrations to trigger a span for a navigation.
@@ -791,7 +794,11 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
791794
/**
792795
* Emit a hook event for triggering right before a navigation span is started.
793796
*/
794-
public emit(hook: 'beforeStartNavigationSpan', options: StartSpanOptions): void;
797+
public emit(
798+
hook: 'beforeStartNavigationSpan',
799+
options: StartSpanOptions,
800+
navigationOptions?: { isRedirect?: boolean },
801+
): void;
795802

796803
/**
797804
* Emit a hook event for browser tracing integrations to trigger a span for a navigation.

0 commit comments

Comments
 (0)