11/* eslint-disable max-lines */
22import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , getActiveSpan } from '@sentry/core' ;
33import { setMeasurement } from '@sentry/core' ;
4- import { browserPerformanceTimeOrigin , getComponentName , htmlTreeAsString , logger , parseUrl } from '@sentry/core' ;
4+ import { browserPerformanceTimeOrigin , getComponentName , htmlTreeAsString , parseUrl } from '@sentry/core' ;
55import type { Measurements , Span , SpanAttributes , StartSpanOptions } from '@sentry/types' ;
66
77import { spanToJSON } from '@sentry/core' ;
8- import { DEBUG_BUILD } from '../debug-build' ;
98import { WINDOW } from '../types' ;
109import { trackClsAsStandaloneSpan } from './cls' ;
1110import {
@@ -241,7 +240,6 @@ function _trackCLS(): () => void {
241240 if ( ! entry ) {
242241 return ;
243242 }
244- DEBUG_BUILD && logger . log ( `[Measurements] Adding CLS ${ metric . value } ` ) ;
245243 _measurements [ 'cls' ] = { value : metric . value , unit : '' } ;
246244 _clsEntry = entry ;
247245 } , true ) ;
@@ -255,7 +253,6 @@ function _trackLCP(): () => void {
255253 return ;
256254 }
257255
258- DEBUG_BUILD && logger . log ( '[Measurements] Adding LCP' ) ;
259256 _measurements [ 'lcp' ] = { value : metric . value , unit : 'millisecond' } ;
260257 _lcpEntry = entry as LargestContentfulPaint ;
261258 } , true ) ;
@@ -271,7 +268,6 @@ function _trackFID(): () => void {
271268
272269 const timeOrigin = msToSec ( browserPerformanceTimeOrigin as number ) ;
273270 const startTime = msToSec ( entry . startTime ) ;
274- DEBUG_BUILD && logger . log ( '[Measurements] Adding FID' ) ;
275271 _measurements [ 'fid' ] = { value : metric . value , unit : 'millisecond' } ;
276272 _measurements [ 'mark.fid' ] = { value : timeOrigin + startTime , unit : 'second' } ;
277273 } ) ;
@@ -284,7 +280,6 @@ function _trackTtfb(): () => void {
284280 return ;
285281 }
286282
287- DEBUG_BUILD && logger . log ( '[Measurements] Adding TTFB' ) ;
288283 _measurements [ 'ttfb' ] = { value : metric . value , unit : 'millisecond' } ;
289284 } ) ;
290285}
@@ -305,7 +300,6 @@ export function addPerformanceEntries(span: Span, options: AddPerformanceEntries
305300 return ;
306301 }
307302
308- DEBUG_BUILD && logger . log ( '[Tracing] Adding & adjusting spans using Performance API' ) ;
309303 const timeOrigin = msToSec ( browserPerformanceTimeOrigin ) ;
310304
311305 const performanceEntries = performance . getEntries ( ) ;
@@ -343,11 +337,9 @@ export function addPerformanceEntries(span: Span, options: AddPerformanceEntries
343337 const shouldRecord = entry . startTime < firstHidden . firstHiddenTime ;
344338
345339 if ( entry . name === 'first-paint' && shouldRecord ) {
346- DEBUG_BUILD && logger . log ( '[Measurements] Adding FP' ) ;
347340 _measurements [ 'fp' ] = { value : entry . startTime , unit : 'millisecond' } ;
348341 }
349342 if ( entry . name === 'first-contentful-paint' && shouldRecord ) {
350- DEBUG_BUILD && logger . log ( '[Measurements] Adding FCP' ) ;
351343 _measurements [ 'fcp' ] = { value : entry . startTime , unit : 'millisecond' } ;
352344 }
353345 break ;
@@ -618,8 +610,6 @@ function _trackNavigator(span: Span): void {
618610/** Add LCP / CLS data to span to allow debugging */
619611function _setWebVitalAttributes ( span : Span ) : void {
620612 if ( _lcpEntry ) {
621- DEBUG_BUILD && logger . log ( '[Measurements] Adding LCP Data' ) ;
622-
623613 // Capture Properties of the LCP element that contributes to the LCP.
624614
625615 if ( _lcpEntry . element ) {
@@ -652,7 +642,6 @@ function _setWebVitalAttributes(span: Span): void {
652642
653643 // See: https://developer.mozilla.org/en-US/docs/Web/API/LayoutShift
654644 if ( _clsEntry && _clsEntry . sources ) {
655- DEBUG_BUILD && logger . log ( '[Measurements] Adding CLS Data' ) ;
656645 _clsEntry . sources . forEach ( ( source , index ) =>
657646 span . setAttribute ( `cls.source.${ index + 1 } ` , htmlTreeAsString ( source . node ) ) ,
658647 ) ;
@@ -685,7 +674,6 @@ function _addTtfbRequestTimeToMeasurements(_measurements: Measurements): void {
685674 const { responseStart, requestStart } = navEntry ;
686675
687676 if ( requestStart <= responseStart ) {
688- DEBUG_BUILD && logger . log ( '[Measurements] Adding TTFB Request Time' ) ;
689677 _measurements [ 'ttfb.requestTime' ] = {
690678 value : responseStart - requestStart ,
691679 unit : 'millisecond' ,
0 commit comments