22import type { Client , Measurements , Span , SpanAttributes , SpanAttributeValue , StartSpanOptions } from '@sentry/core' ;
33import {
44 browserPerformanceTimeOrigin ,
5+ debug ,
56 getActiveSpan ,
67 getComponentName ,
78 htmlTreeAsString ,
@@ -27,7 +28,6 @@ import { getBrowserPerformanceAPI, isMeasurementValue, msToSec, startAndEndSpan
2728import { getActivationStart } from './web-vitals/lib/getActivationStart' ;
2829import { getNavigationEntry } from './web-vitals/lib/getNavigationEntry' ;
2930import { getVisibilityWatcher } from './web-vitals/lib/getVisibilityWatcher' ;
30- import { debug } from '@sentry/core' ;
3131interface NavigatorNetworkInformation {
3232 readonly connection ?: NetworkInformation ;
3333}
@@ -468,15 +468,18 @@ export function addPerformanceEntries(span: Span, options: AddPerformanceEntries
468468 }
469469
470470 // Set timeOrigin which denotes the timestamp which to base the LCP/FCP/FP/TTFB measurements on
471- span . setAttribute ( 'performance.timeOrigin' , timeOrigin ) ;
471+ span . setAttribute ( spanStreamingEnabled ? 'browser.performance.time_origin' : 'performance.timeOrigin' , timeOrigin ) ;
472472
473473 // In prerendering scenarios, where a page might be prefetched and pre-rendered before the user clicks the link,
474474 // the navigation starts earlier than when the user clicks it. Web Vitals should always be based on the
475475 // user-perceived time, so they are not reported from the actual start of the navigation, but rather from the
476476 // time where the user actively started the navigation, for example by clicking a link.
477477 // This is user action is called "activation" and the time between navigation and activation is stored in
478478 // the `activationStart` attribute of the "navigation" PerformanceEntry.
479- span . setAttribute ( 'performance.activationStart' , getActivationStart ( ) ) ;
479+ span . setAttribute (
480+ spanStreamingEnabled ? 'browser.performance.navigation.activation_start' : 'performance.activationStart' ,
481+ getActivationStart ( ) ,
482+ ) ;
480483 }
481484
482485 _lcpEntry = undefined ;
@@ -810,10 +813,11 @@ function _trackNavigator(span: Span, spanStreamingEnabled: boolean | undefined):
810813 }
811814
812815 if ( isMeasurementValue ( navigator . hardwareConcurrency ) ) {
813- span . setAttribute (
814- spanStreamingEnabled ? 'device.processor_count' : 'hardwareConcurrency' ,
815- String ( navigator . hardwareConcurrency ) ,
816- ) ;
816+ if ( spanStreamingEnabled ) {
817+ span . setAttribute ( 'device.processor_count' , navigator . hardwareConcurrency ) ;
818+ } else {
819+ span . setAttribute ( 'hardwareConcurrency' , String ( navigator . hardwareConcurrency ) ) ;
820+ }
817821 }
818822}
819823
0 commit comments