1
1
/* eslint-disable max-lines */
2
2
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , getActiveSpan } from '@sentry/core' ;
3
3
import { setMeasurement } from '@sentry/core' ;
4
- import { browserPerformanceTimeOrigin , getComponentName , htmlTreeAsString , logger , parseUrl } from '@sentry/core' ;
4
+ import { browserPerformanceTimeOrigin , getComponentName , htmlTreeAsString , parseUrl } from '@sentry/core' ;
5
5
import type { Measurements , Span , SpanAttributes , StartSpanOptions } from '@sentry/types' ;
6
6
7
7
import { spanToJSON } from '@sentry/core' ;
8
- import { DEBUG_BUILD } from '../debug-build' ;
9
8
import { WINDOW } from '../types' ;
10
9
import { trackClsAsStandaloneSpan } from './cls' ;
11
10
import {
@@ -241,7 +240,6 @@ function _trackCLS(): () => void {
241
240
if ( ! entry ) {
242
241
return ;
243
242
}
244
- DEBUG_BUILD && logger . log ( `[Measurements] Adding CLS ${ metric . value } ` ) ;
245
243
_measurements [ 'cls' ] = { value : metric . value , unit : '' } ;
246
244
_clsEntry = entry ;
247
245
} , true ) ;
@@ -255,7 +253,6 @@ function _trackLCP(): () => void {
255
253
return ;
256
254
}
257
255
258
- DEBUG_BUILD && logger . log ( '[Measurements] Adding LCP' ) ;
259
256
_measurements [ 'lcp' ] = { value : metric . value , unit : 'millisecond' } ;
260
257
_lcpEntry = entry as LargestContentfulPaint ;
261
258
} , true ) ;
@@ -271,7 +268,6 @@ function _trackFID(): () => void {
271
268
272
269
const timeOrigin = msToSec ( browserPerformanceTimeOrigin as number ) ;
273
270
const startTime = msToSec ( entry . startTime ) ;
274
- DEBUG_BUILD && logger . log ( '[Measurements] Adding FID' ) ;
275
271
_measurements [ 'fid' ] = { value : metric . value , unit : 'millisecond' } ;
276
272
_measurements [ 'mark.fid' ] = { value : timeOrigin + startTime , unit : 'second' } ;
277
273
} ) ;
@@ -284,7 +280,6 @@ function _trackTtfb(): () => void {
284
280
return ;
285
281
}
286
282
287
- DEBUG_BUILD && logger . log ( '[Measurements] Adding TTFB' ) ;
288
283
_measurements [ 'ttfb' ] = { value : metric . value , unit : 'millisecond' } ;
289
284
} ) ;
290
285
}
@@ -305,7 +300,6 @@ export function addPerformanceEntries(span: Span, options: AddPerformanceEntries
305
300
return ;
306
301
}
307
302
308
- DEBUG_BUILD && logger . log ( '[Tracing] Adding & adjusting spans using Performance API' ) ;
309
303
const timeOrigin = msToSec ( browserPerformanceTimeOrigin ) ;
310
304
311
305
const performanceEntries = performance . getEntries ( ) ;
@@ -343,11 +337,9 @@ export function addPerformanceEntries(span: Span, options: AddPerformanceEntries
343
337
const shouldRecord = entry . startTime < firstHidden . firstHiddenTime ;
344
338
345
339
if ( entry . name === 'first-paint' && shouldRecord ) {
346
- DEBUG_BUILD && logger . log ( '[Measurements] Adding FP' ) ;
347
340
_measurements [ 'fp' ] = { value : entry . startTime , unit : 'millisecond' } ;
348
341
}
349
342
if ( entry . name === 'first-contentful-paint' && shouldRecord ) {
350
- DEBUG_BUILD && logger . log ( '[Measurements] Adding FCP' ) ;
351
343
_measurements [ 'fcp' ] = { value : entry . startTime , unit : 'millisecond' } ;
352
344
}
353
345
break ;
@@ -618,8 +610,6 @@ function _trackNavigator(span: Span): void {
618
610
/** Add LCP / CLS data to span to allow debugging */
619
611
function _setWebVitalAttributes ( span : Span ) : void {
620
612
if ( _lcpEntry ) {
621
- DEBUG_BUILD && logger . log ( '[Measurements] Adding LCP Data' ) ;
622
-
623
613
// Capture Properties of the LCP element that contributes to the LCP.
624
614
625
615
if ( _lcpEntry . element ) {
@@ -652,7 +642,6 @@ function _setWebVitalAttributes(span: Span): void {
652
642
653
643
// See: https://developer.mozilla.org/en-US/docs/Web/API/LayoutShift
654
644
if ( _clsEntry && _clsEntry . sources ) {
655
- DEBUG_BUILD && logger . log ( '[Measurements] Adding CLS Data' ) ;
656
645
_clsEntry . sources . forEach ( ( source , index ) =>
657
646
span . setAttribute ( `cls.source.${ index + 1 } ` , htmlTreeAsString ( source . node ) ) ,
658
647
) ;
@@ -685,7 +674,6 @@ function _addTtfbRequestTimeToMeasurements(_measurements: Measurements): void {
685
674
const { responseStart, requestStart } = navEntry ;
686
675
687
676
if ( requestStart <= responseStart ) {
688
- DEBUG_BUILD && logger . log ( '[Measurements] Adding TTFB Request Time' ) ;
689
677
_measurements [ 'ttfb.requestTime' ] = {
690
678
value : responseStart - requestStart ,
691
679
unit : 'millisecond' ,
0 commit comments