@@ -576,8 +576,9 @@ const assignDocumentDurations = (span: api.Span) => {
576576 request : calculateDuration ( 'requestStart' , 'requestEnd' , events ) ,
577577 response : calculateDuration ( 'responseStart' , 'responseEnd' , events ) ,
578578 }
579- for ( const _integration of otelConfig ?. getIntegrations ?.( ) ?? [ ] ) {
580- if ( durations_ns . document_load > 0 ) {
579+ const integrations = otelConfig ?. getIntegrations ?.( ) ?? [ ]
580+ if ( durations_ns . document_load !== undefined ) {
581+ for ( const _integration of integrations ) {
581582 _integration . recordGauge ( otelConfig ?. sessionSecureId ?? '' , {
582583 name : LD_METRIC_NAME_DOCUMENT_LOAD ,
583584 value : durations_ns . document_load / 1e6 ,
@@ -586,7 +587,7 @@ const assignDocumentDurations = (span: api.Span) => {
586587 }
587588
588589 Object . entries ( durations_ns ) . forEach ( ( [ key , value ] ) => {
589- if ( value > 0 ) {
590+ if ( value !== undefined ) {
590591 span . setAttribute ( `timings.${ key } .ns` , value )
591592 span . setAttribute (
592593 `timings.${ key } .readable` ,
@@ -610,7 +611,7 @@ function calculateDuration(
610611 const endEvent = events . find ( ( e ) => e . name === endEventName )
611612
612613 if ( ! startEvent || ! endEvent ) {
613- return 0
614+ return undefined
614615 }
615616
616617 const startNs = startEvent . time [ 0 ] * 1e9 + startEvent . time [ 1 ]
@@ -624,20 +625,15 @@ const assignResourceFetchDurations = (
624625) => {
625626 const durations = {
626627 domain_lookup :
627- ( resource . domainLookupEnd - resource . domainLookupStart ) * 1e6 ,
628- connect : ( resource . connectEnd - resource . connectStart ) * 1e6 ,
629- request : ( resource . responseEnd - resource . requestStart ) * 1e6 ,
630- response : ( resource . responseEnd - resource . responseStart ) * 1e6 ,
628+ ( resource . domainLookupEnd - resource . domainLookupStart ) * 1e9 ,
629+ connect : ( resource . connectEnd - resource . connectStart ) * 1e9 ,
630+ request : ( resource . responseEnd - resource . requestStart ) * 1e9 ,
631+ response : ( resource . responseEnd - resource . responseStart ) * 1e9 ,
631632 }
632633
633634 Object . entries ( durations ) . forEach ( ( [ key , value ] ) => {
634- if ( value > 0 ) {
635- span . setAttribute ( `timings.${ key } .ns` , value )
636- span . setAttribute (
637- `timings.${ key } .readable` ,
638- humanizeDuration ( value ) ,
639- )
640- }
635+ span . setAttribute ( `timings.${ key } .ns` , value )
636+ span . setAttribute ( `timings.${ key } .readable` , humanizeDuration ( value ) )
641637 } )
642638}
643639
0 commit comments