1
1
/* eslint-disable max-lines, complexity */
2
2
import type { IdleTransaction } from '@sentry/core' ;
3
- import { getClient } from '@sentry/core' ;
4
3
import { getCurrentHub } from '@sentry/core' ;
5
4
import {
6
5
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ,
@@ -11,6 +10,7 @@ import {
11
10
startIdleTransaction ,
12
11
} from '@sentry/core' ;
13
12
import type {
13
+ Client ,
14
14
IntegrationFn ,
15
15
StartSpanOptions ,
16
16
Transaction ,
@@ -336,7 +336,7 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
336
336
origin : 'auto.pageload.browser' ,
337
337
metadata : { source : 'url' } ,
338
338
} ;
339
- startBrowserTracingPageLoadSpan ( context ) ;
339
+ startBrowserTracingPageLoadSpan ( client , context ) ;
340
340
}
341
341
342
342
if ( options . instrumentNavigation && client . emit ) {
@@ -364,7 +364,7 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
364
364
metadata : { source : 'url' } ,
365
365
} ;
366
366
367
- startBrowserTracingNavigationSpan ( context ) ;
367
+ startBrowserTracingNavigationSpan ( client , context ) ;
368
368
}
369
369
} ) ;
370
370
}
@@ -395,9 +395,8 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
395
395
* Manually start a page load span.
396
396
* This will only do something if the BrowserTracing integration has been setup.
397
397
*/
398
- export function startBrowserTracingPageLoadSpan ( spanOptions : StartSpanOptions ) : void {
399
- const client = getClient ( ) ;
400
- if ( ! client || ! client . emit ) {
398
+ export function startBrowserTracingPageLoadSpan ( client : Client , spanOptions : StartSpanOptions ) : void {
399
+ if ( ! client . emit ) {
401
400
return ;
402
401
}
403
402
@@ -408,9 +407,8 @@ export function startBrowserTracingPageLoadSpan(spanOptions: StartSpanOptions):
408
407
* Manually start a navigation span.
409
408
* This will only do something if the BrowserTracing integration has been setup.
410
409
*/
411
- export function startBrowserTracingNavigationSpan ( spanOptions : StartSpanOptions ) : void {
412
- const client = getClient ( ) ;
413
- if ( ! client || ! client . emit ) {
410
+ export function startBrowserTracingNavigationSpan ( client : Client , spanOptions : StartSpanOptions ) : void {
411
+ if ( ! client . emit ) {
414
412
return ;
415
413
}
416
414
0 commit comments