11/* eslint-disable max-lines */
2- import type { SentrySpan } from '@sentry/core' ;
32import { getActiveSpan , startInactiveSpan } from '@sentry/core' ;
43import { setMeasurement } from '@sentry/core' ;
54import type { Measurements , Span , StartSpanOptions } from '@sentry/types' ;
@@ -445,15 +444,11 @@ function _trackNavigator(span: Span): void {
445444 const connection = navigator . connection ;
446445 if ( connection ) {
447446 if ( connection . effectiveType ) {
448- // TODO: Can we rewrite this to an attribute?
449- // eslint-disable-next-line deprecation/deprecation
450- ( span as SentrySpan ) . setTag ( 'effectiveConnectionType' , connection . effectiveType ) ;
447+ span . setAttribute ( 'effectiveConnectionType' , connection . effectiveType ) ;
451448 }
452449
453450 if ( connection . type ) {
454- // TODO: Can we rewrite this to an attribute?
455- // eslint-disable-next-line deprecation/deprecation
456- ( span as SentrySpan ) . setTag ( 'connectionType' , connection . type ) ;
451+ span . setAttribute ( 'connectionType' , connection . type ) ;
457452 }
458453
459454 if ( isMeasurementValue ( connection . rtt ) ) {
@@ -462,15 +457,11 @@ function _trackNavigator(span: Span): void {
462457 }
463458
464459 if ( isMeasurementValue ( navigator . deviceMemory ) ) {
465- // TODO: Can we rewrite this to an attribute?
466- // eslint-disable-next-line deprecation/deprecation
467- ( span as SentrySpan ) . setTag ( 'deviceMemory' , `${ navigator . deviceMemory } GB` ) ;
460+ span . setAttribute ( 'deviceMemory' , `${ navigator . deviceMemory } GB` ) ;
468461 }
469462
470463 if ( isMeasurementValue ( navigator . hardwareConcurrency ) ) {
471- // TODO: Can we rewrite this to an attribute?
472- // eslint-disable-next-line deprecation/deprecation
473- ( span as SentrySpan ) . setTag ( 'hardwareConcurrency' , String ( navigator . hardwareConcurrency ) ) ;
464+ span . setAttribute ( 'hardwareConcurrency' , String ( navigator . hardwareConcurrency ) ) ;
474465 }
475466}
476467
@@ -482,36 +473,26 @@ function _tagMetricInfo(span: Span): void {
482473 // Capture Properties of the LCP element that contributes to the LCP.
483474
484475 if ( _lcpEntry . element ) {
485- // TODO: Can we rewrite this to an attribute?
486- // eslint-disable-next-line deprecation/deprecation
487- ( span as SentrySpan ) . setTag ( 'lcp.element' , htmlTreeAsString ( _lcpEntry . element ) ) ;
476+ span . setAttribute ( 'lcp.element' , htmlTreeAsString ( _lcpEntry . element ) ) ;
488477 }
489478
490479 if ( _lcpEntry . id ) {
491- // TODO: Can we rewrite this to an attribute?
492- // eslint-disable-next-line deprecation/deprecation
493- ( span as SentrySpan ) . setTag ( 'lcp.id' , _lcpEntry . id ) ;
480+ span . setAttribute ( 'lcp.id' , _lcpEntry . id ) ;
494481 }
495482
496483 if ( _lcpEntry . url ) {
497484 // Trim URL to the first 200 characters.
498- // TODO: Can we rewrite this to an attribute?
499- // eslint-disable-next-line deprecation/deprecation
500- ( span as SentrySpan ) . setTag ( 'lcp.url' , _lcpEntry . url . trim ( ) . slice ( 0 , 200 ) ) ;
485+ span . setAttribute ( 'lcp.url' , _lcpEntry . url . trim ( ) . slice ( 0 , 200 ) ) ;
501486 }
502487
503- // TODO: Can we rewrite this to an attribute?
504- // eslint-disable-next-line deprecation/deprecation
505- ( span as SentrySpan ) . setTag ( 'lcp.size' , _lcpEntry . size ) ;
488+ span . setAttribute ( 'lcp.size' , _lcpEntry . size ) ;
506489 }
507490
508491 // See: https://developer.mozilla.org/en-US/docs/Web/API/LayoutShift
509492 if ( _clsEntry && _clsEntry . sources ) {
510493 DEBUG_BUILD && logger . log ( '[Measurements] Adding CLS Data' ) ;
511494 _clsEntry . sources . forEach ( ( source , index ) =>
512- // TODO: Can we rewrite this to an attribute?
513- // eslint-disable-next-line deprecation/deprecation
514- ( span as SentrySpan ) . setTag ( `cls.source.${ index + 1 } ` , htmlTreeAsString ( source . node ) ) ,
495+ span . setAttribute ( `cls.source.${ index + 1 } ` , htmlTreeAsString ( source . node ) ) ,
515496 ) ;
516497 }
517498}
0 commit comments