11/* eslint-disable max-lines, complexity */
22import type { IdleTransaction } from '@sentry/core' ;
3- import { getClient } from '@sentry/core' ;
43import { getCurrentHub } from '@sentry/core' ;
54import {
65 SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ,
@@ -11,6 +10,7 @@ import {
1110 startIdleTransaction ,
1211} from '@sentry/core' ;
1312import type {
13+ Client ,
1414 IntegrationFn ,
1515 StartSpanOptions ,
1616 Transaction ,
@@ -336,7 +336,7 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
336336 origin : 'auto.pageload.browser' ,
337337 metadata : { source : 'url' } ,
338338 } ;
339- startBrowserTracingPageLoadSpan ( context ) ;
339+ startBrowserTracingPageLoadSpan ( client , context ) ;
340340 }
341341
342342 if ( options . instrumentNavigation && client . emit ) {
@@ -364,7 +364,7 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
364364 metadata : { source : 'url' } ,
365365 } ;
366366
367- startBrowserTracingNavigationSpan ( context ) ;
367+ startBrowserTracingNavigationSpan ( client , context ) ;
368368 }
369369 } ) ;
370370 }
@@ -395,9 +395,8 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
395395 * Manually start a page load span.
396396 * This will only do something if the BrowserTracing integration has been setup.
397397 */
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 ) {
401400 return ;
402401 }
403402
@@ -408,9 +407,8 @@ export function startBrowserTracingPageLoadSpan(spanOptions: StartSpanOptions):
408407 * Manually start a navigation span.
409408 * This will only do something if the BrowserTracing integration has been setup.
410409 */
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 ) {
414412 return ;
415413 }
416414
0 commit comments