@@ -445,15 +445,11 @@ function _trackNavigator(span: Span): void {
445
445
const connection = navigator . connection ;
446
446
if ( connection ) {
447
447
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 ) ;
448
+ transaction . setAttribute ( 'effectiveConnectionType' , connection . effectiveType ) ;
451
449
}
452
450
453
451
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 ) ;
452
+ transaction . setAttribute ( 'connectionType' , connection . type ) ;
457
453
}
458
454
459
455
if ( isMeasurementValue ( connection . rtt ) ) {
@@ -462,15 +458,11 @@ function _trackNavigator(span: Span): void {
462
458
}
463
459
464
460
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` ) ;
461
+ transaction . setAttribute ( 'deviceMemory' , `${ navigator . deviceMemory } GB` ) ;
468
462
}
469
463
470
464
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 ) ) ;
465
+ transaction . setAttribute ( 'hardwareConcurrency' , String ( navigator . hardwareConcurrency ) ) ;
474
466
}
475
467
}
476
468
@@ -482,36 +474,26 @@ function _tagMetricInfo(span: Span): void {
482
474
// Capture Properties of the LCP element that contributes to the LCP.
483
475
484
476
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 ) ) ;
477
+ transaction . setAttribute ( 'lcp.element' , htmlTreeAsString ( _lcpEntry . element ) ) ;
488
478
}
489
479
490
480
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 ) ;
481
+ transaction . setAttribute ( 'lcp.id' , _lcpEntry . id ) ;
494
482
}
495
483
496
484
if ( _lcpEntry . url ) {
497
485
// 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 ) ) ;
486
+ transaction . setAttribute ( 'lcp.url' , _lcpEntry . url . trim ( ) . slice ( 0 , 200 ) ) ;
501
487
}
502
488
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 ) ;
489
+ transaction . setAttribute ( 'lcp.size' , _lcpEntry . size ) ;
506
490
}
507
491
508
492
// See: https://developer.mozilla.org/en-US/docs/Web/API/LayoutShift
509
493
if ( _clsEntry && _clsEntry . sources ) {
510
494
DEBUG_BUILD && logger . log ( '[Measurements] Adding CLS Data' ) ;
511
495
_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 ) ) ,
496
+ transaction . setAttribute ( `cls.source.${ index + 1 } ` , htmlTreeAsString ( source . node ) ) ,
515
497
) ;
516
498
}
517
499
}
0 commit comments