@kubesense/kubesense-browser-rum-core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +3 -0
- package/cjs/boot/preStartRum.d.ts +7 -0
- package/cjs/boot/preStartRum.js +190 -0
- package/cjs/boot/preStartRum.js.map +1 -0
- package/cjs/boot/rumPublicApi.d.ts +409 -0
- package/cjs/boot/rumPublicApi.js +168 -0
- package/cjs/boot/rumPublicApi.js.map +1 -0
- package/cjs/boot/startRum.d.ts +109 -0
- package/cjs/boot/startRum.js +153 -0
- package/cjs/boot/startRum.js.map +1 -0
- package/cjs/browser/cookieObservable.d.ts +8 -0
- package/cjs/browser/cookieObservable.js +39 -0
- package/cjs/browser/cookieObservable.js.map +1 -0
- package/cjs/browser/domMutationObservable.d.ts +27 -0
- package/cjs/browser/domMutationObservable.js +58 -0
- package/cjs/browser/domMutationObservable.js.map +1 -0
- package/cjs/browser/firstInputPolyfill.d.ts +8 -0
- package/cjs/browser/firstInputPolyfill.js +68 -0
- package/cjs/browser/firstInputPolyfill.js.map +1 -0
- package/cjs/browser/htmlDomUtils.d.ts +13 -0
- package/cjs/browser/htmlDomUtils.js +46 -0
- package/cjs/browser/htmlDomUtils.js.map +1 -0
- package/cjs/browser/locationChangeObservable.d.ts +7 -0
- package/cjs/browser/locationChangeObservable.js +51 -0
- package/cjs/browser/locationChangeObservable.js.map +1 -0
- package/cjs/browser/performanceObservable.d.ts +174 -0
- package/cjs/browser/performanceObservable.js +126 -0
- package/cjs/browser/performanceObservable.js.map +1 -0
- package/cjs/browser/performanceUtils.d.ts +7 -0
- package/cjs/browser/performanceUtils.js +42 -0
- package/cjs/browser/performanceUtils.js.map +1 -0
- package/cjs/browser/scroll.d.ts +2 -0
- package/cjs/browser/scroll.js +33 -0
- package/cjs/browser/scroll.js.map +1 -0
- package/cjs/browser/viewportObservable.d.ts +10 -0
- package/cjs/browser/viewportObservable.js +37 -0
- package/cjs/browser/viewportObservable.js.map +1 -0
- package/cjs/browser/windowOpenObservable.d.ts +5 -0
- package/cjs/browser/windowOpenObservable.js +10 -0
- package/cjs/browser/windowOpenObservable.js.map +1 -0
- package/cjs/domain/action/actionCollection.d.ts +21 -0
- package/cjs/domain/action/actionCollection.js +96 -0
- package/cjs/domain/action/actionCollection.js.map +1 -0
- package/cjs/domain/action/actionNameConstants.d.ts +18 -0
- package/cjs/domain/action/actionNameConstants.js +11 -0
- package/cjs/domain/action/actionNameConstants.js.map +1 -0
- package/cjs/domain/action/clickChain.d.ts +8 -0
- package/cjs/domain/action/clickChain.js +61 -0
- package/cjs/domain/action/clickChain.js.map +1 -0
- package/cjs/domain/action/computeFrustration.d.ts +6 -0
- package/cjs/domain/action/computeFrustration.js +70 -0
- package/cjs/domain/action/computeFrustration.js.map +1 -0
- package/cjs/domain/action/getActionNameFromElement.d.ts +4 -0
- package/cjs/domain/action/getActionNameFromElement.js +239 -0
- package/cjs/domain/action/getActionNameFromElement.js.map +1 -0
- package/cjs/domain/action/interactionSelectorCache.d.ts +5 -0
- package/cjs/domain/action/interactionSelectorCache.js +23 -0
- package/cjs/domain/action/interactionSelectorCache.js.map +1 -0
- package/cjs/domain/action/listenActionEvents.d.ts +19 -0
- package/cjs/domain/action/listenActionEvents.js +61 -0
- package/cjs/domain/action/listenActionEvents.js.map +1 -0
- package/cjs/domain/action/trackClickActions.d.ts +81 -0
- package/cjs/domain/action/trackClickActions.js +237 -0
- package/cjs/domain/action/trackClickActions.js.map +1 -0
- package/cjs/domain/assembly.d.ts +5 -0
- package/cjs/domain/assembly.js +102 -0
- package/cjs/domain/assembly.js.map +1 -0
- package/cjs/domain/configuration/configuration.d.ts +325 -0
- package/cjs/domain/configuration/configuration.js +205 -0
- package/cjs/domain/configuration/configuration.js.map +1 -0
- package/cjs/domain/configuration/index.d.ts +2 -0
- package/cjs/domain/configuration/index.js +19 -0
- package/cjs/domain/configuration/index.js.map +1 -0
- package/cjs/domain/configuration/jsonPathParser.d.ts +28 -0
- package/cjs/domain/configuration/jsonPathParser.js +159 -0
- package/cjs/domain/configuration/jsonPathParser.js.map +1 -0
- package/cjs/domain/configuration/remoteConfiguration.d.ts +39 -0
- package/cjs/domain/configuration/remoteConfiguration.js +243 -0
- package/cjs/domain/configuration/remoteConfiguration.js.map +1 -0
- package/cjs/domain/configuration/remoteConfiguration.types.d.ts +138 -0
- package/cjs/domain/configuration/remoteConfiguration.types.js +7 -0
- package/cjs/domain/configuration/remoteConfiguration.types.js.map +1 -0
- package/cjs/domain/contexts/ciVisibilityContext.d.ts +12 -0
- package/cjs/domain/contexts/ciVisibilityContext.js +34 -0
- package/cjs/domain/contexts/ciVisibilityContext.js.map +1 -0
- package/cjs/domain/contexts/connectivityContext.d.ts +2 -0
- package/cjs/domain/contexts/connectivityContext.js +11 -0
- package/cjs/domain/contexts/connectivityContext.js.map +1 -0
- package/cjs/domain/contexts/defaultContext.d.ts +4 -0
- package/cjs/domain/contexts/defaultContext.js +34 -0
- package/cjs/domain/contexts/defaultContext.js.map +1 -0
- package/cjs/domain/contexts/displayContext.d.ts +6 -0
- package/cjs/domain/contexts/displayContext.js +28 -0
- package/cjs/domain/contexts/displayContext.js.map +1 -0
- package/cjs/domain/contexts/featureFlagContext.d.ts +19 -0
- package/cjs/domain/contexts/featureFlagContext.js +53 -0
- package/cjs/domain/contexts/featureFlagContext.js.map +1 -0
- package/cjs/domain/contexts/internalContext.d.ts +12 -0
- package/cjs/domain/contexts/internalContext.js +26 -0
- package/cjs/domain/contexts/internalContext.js.map +1 -0
- package/cjs/domain/contexts/pageStateHistory.d.ts +23 -0
- package/cjs/domain/contexts/pageStateHistory.js +104 -0
- package/cjs/domain/contexts/pageStateHistory.js.map +1 -0
- package/cjs/domain/contexts/sessionContext.d.ts +5 -0
- package/cjs/domain/contexts/sessionContext.js +47 -0
- package/cjs/domain/contexts/sessionContext.js.map +1 -0
- package/cjs/domain/contexts/syntheticsContext.d.ts +2 -0
- package/cjs/domain/contexts/syntheticsContext.js +25 -0
- package/cjs/domain/contexts/syntheticsContext.js.map +1 -0
- package/cjs/domain/contexts/trackingConsentContext.d.ts +3 -0
- package/cjs/domain/contexts/trackingConsentContext.js +14 -0
- package/cjs/domain/contexts/trackingConsentContext.js.map +1 -0
- package/cjs/domain/contexts/urlContexts.d.ts +22 -0
- package/cjs/domain/contexts/urlContexts.js +64 -0
- package/cjs/domain/contexts/urlContexts.js.map +1 -0
- package/cjs/domain/contexts/userAgentDataContext.d.ts +2 -0
- package/cjs/domain/contexts/userAgentDataContext.js +31 -0
- package/cjs/domain/contexts/userAgentDataContext.js.map +1 -0
- package/cjs/domain/contexts/viewHistory.d.ts +17 -0
- package/cjs/domain/contexts/viewHistory.js +48 -0
- package/cjs/domain/contexts/viewHistory.js.map +1 -0
- package/cjs/domain/discardNegativeDuration.d.ts +2 -0
- package/cjs/domain/discardNegativeDuration.js +8 -0
- package/cjs/domain/discardNegativeDuration.js.map +1 -0
- package/cjs/domain/error/errorCollection.d.ts +17 -0
- package/cjs/domain/error/errorCollection.js +74 -0
- package/cjs/domain/error/errorCollection.js.map +1 -0
- package/cjs/domain/error/trackConsoleError.d.ts +4 -0
- package/cjs/domain/error/trackConsoleError.js +13 -0
- package/cjs/domain/error/trackConsoleError.js.map +1 -0
- package/cjs/domain/error/trackReportError.d.ts +5 -0
- package/cjs/domain/error/trackReportError.js +16 -0
- package/cjs/domain/error/trackReportError.js.map +1 -0
- package/cjs/domain/event/eventCollection.d.ts +10 -0
- package/cjs/domain/event/eventCollection.js +27 -0
- package/cjs/domain/event/eventCollection.js.map +1 -0
- package/cjs/domain/getSelectorFromElement.d.ts +64 -0
- package/cjs/domain/getSelectorFromElement.js +218 -0
- package/cjs/domain/getSelectorFromElement.js.map +1 -0
- package/cjs/domain/getSessionReplayUrl.d.ts +9 -0
- package/cjs/domain/getSessionReplayUrl.js +34 -0
- package/cjs/domain/getSessionReplayUrl.js.map +1 -0
- package/cjs/domain/hooks.d.ts +23 -0
- package/cjs/domain/hooks.js +6 -0
- package/cjs/domain/hooks.js.map +1 -0
- package/cjs/domain/lifeCycle.d.ts +73 -0
- package/cjs/domain/lifeCycle.js +6 -0
- package/cjs/domain/lifeCycle.js.map +1 -0
- package/cjs/domain/limitModification.d.ts +8 -0
- package/cjs/domain/limitModification.js +46 -0
- package/cjs/domain/limitModification.js.map +1 -0
- package/cjs/domain/longTask/longTaskCollection.d.ts +18 -0
- package/cjs/domain/longTask/longTaskCollection.js +91 -0
- package/cjs/domain/longTask/longTaskCollection.js.map +1 -0
- package/cjs/domain/plugins.d.ts +40 -0
- package/cjs/domain/plugins.js +15 -0
- package/cjs/domain/plugins.js.map +1 -0
- package/cjs/domain/privacy.d.ts +44 -0
- package/cjs/domain/privacy.js +313 -0
- package/cjs/domain/privacy.js.map +1 -0
- package/cjs/domain/privacyConstants.d.ts +23 -0
- package/cjs/domain/privacyConstants.js +39 -0
- package/cjs/domain/privacyConstants.js.map +1 -0
- package/cjs/domain/requestCollection.d.ts +54 -0
- package/cjs/domain/requestCollection.js +111 -0
- package/cjs/domain/requestCollection.js.map +1 -0
- package/cjs/domain/resource/graphql.d.ts +23 -0
- package/cjs/domain/resource/graphql.js +97 -0
- package/cjs/domain/resource/graphql.js.map +1 -0
- package/cjs/domain/resource/matchRequestResourceEntry.d.ts +16 -0
- package/cjs/domain/resource/matchRequestResourceEntry.js +49 -0
- package/cjs/domain/resource/matchRequestResourceEntry.js.map +1 -0
- package/cjs/domain/resource/requestRegistry.d.ts +9 -0
- package/cjs/domain/resource/requestRegistry.js +41 -0
- package/cjs/domain/resource/requestRegistry.js.map +1 -0
- package/cjs/domain/resource/resourceCollection.d.ts +7 -0
- package/cjs/domain/resource/resourceCollection.js +190 -0
- package/cjs/domain/resource/resourceCollection.js.map +1 -0
- package/cjs/domain/resource/resourceUtils.d.ts +55 -0
- package/cjs/domain/resource/resourceUtils.js +259 -0
- package/cjs/domain/resource/resourceUtils.js.map +1 -0
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +4 -0
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js +24 -0
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js.map +1 -0
- package/cjs/domain/rumSessionManager.d.ts +36 -0
- package/cjs/domain/rumSessionManager.js +77 -0
- package/cjs/domain/rumSessionManager.js.map +1 -0
- package/cjs/domain/sampler/sampler.d.ts +10 -0
- package/cjs/domain/sampler/sampler.js +63 -0
- package/cjs/domain/sampler/sampler.js.map +1 -0
- package/cjs/domain/startCustomerDataTelemetry.d.ts +4 -0
- package/cjs/domain/startCustomerDataTelemetry.js +56 -0
- package/cjs/domain/startCustomerDataTelemetry.js.map +1 -0
- package/cjs/domain/tracing/getDocumentTraceId.d.ts +12 -0
- package/cjs/domain/tracing/getDocumentTraceId.js +76 -0
- package/cjs/domain/tracing/getDocumentTraceId.js.map +1 -0
- package/cjs/domain/tracing/identifier.d.ts +13 -0
- package/cjs/domain/tracing/identifier.js +55 -0
- package/cjs/domain/tracing/identifier.js.map +1 -0
- package/cjs/domain/tracing/sampler.d.ts +10 -0
- package/cjs/domain/tracing/sampler.js +69 -0
- package/cjs/domain/tracing/sampler.js.map +1 -0
- package/cjs/domain/tracing/tracer.d.ts +30 -0
- package/cjs/domain/tracing/tracer.js +161 -0
- package/cjs/domain/tracing/tracer.js.map +1 -0
- package/cjs/domain/tracing/tracer.types.d.ts +12 -0
- package/cjs/domain/tracing/tracer.types.js +3 -0
- package/cjs/domain/tracing/tracer.types.js.map +1 -0
- package/cjs/domain/trackEventCounts.d.ts +17 -0
- package/cjs/domain/trackEventCounts.js +50 -0
- package/cjs/domain/trackEventCounts.js.map +1 -0
- package/cjs/domain/view/bfCacheSupport.d.ts +2 -0
- package/cjs/domain/view/bfCacheSupport.js +13 -0
- package/cjs/domain/view/bfCacheSupport.js.map +1 -0
- package/cjs/domain/view/trackViewEventCounts.d.ts +5 -0
- package/cjs/domain/view/trackViewEventCounts.js +16 -0
- package/cjs/domain/view/trackViewEventCounts.js.map +1 -0
- package/cjs/domain/view/trackViews.d.ts +65 -0
- package/cjs/domain/view/trackViews.js +275 -0
- package/cjs/domain/view/trackViews.js.map +1 -0
- package/cjs/domain/view/viewCollection.d.ts +18 -0
- package/cjs/domain/view/viewCollection.js +153 -0
- package/cjs/domain/view/viewCollection.js.map +1 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.d.ts +6 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js +32 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +1 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.d.ts +18 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js +44 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js.map +1 -0
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +6 -0
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +44 -0
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +8 -0
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js +17 -0
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +21 -0
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js +37 -0
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +37 -0
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js +135 -0
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +13 -0
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js +39 -0
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackFirstHidden.d.ts +10 -0
- package/cjs/domain/view/viewMetrics/trackFirstHidden.js +33 -0
- package/cjs/domain/view/viewMetrics/trackFirstHidden.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackFirstInput.d.ts +19 -0
- package/cjs/domain/view/viewMetrics/trackFirstInput.js +43 -0
- package/cjs/domain/view/viewMetrics/trackFirstInput.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +15 -0
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js +41 -0
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +25 -0
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js +155 -0
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +18 -0
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js +61 -0
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackLoadingTime.d.ts +14 -0
- package/cjs/domain/view/viewMetrics/trackLoadingTime.js +50 -0
- package/cjs/domain/view/viewMetrics/trackLoadingTime.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.d.ts +14 -0
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.js +43 -0
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.d.ts +25 -0
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.js +78 -0
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.js.map +1 -0
- package/cjs/domain/vital/vitalCollection.d.ts +55 -0
- package/cjs/domain/vital/vitalCollection.js +113 -0
- package/cjs/domain/vital/vitalCollection.js.map +1 -0
- package/cjs/domain/waitPageActivityEnd.d.ts +54 -0
- package/cjs/domain/waitPageActivityEnd.js +129 -0
- package/cjs/domain/waitPageActivityEnd.js.map +1 -0
- package/cjs/domainContext.types.d.ts +39 -0
- package/cjs/domainContext.types.js +6 -0
- package/cjs/domainContext.types.js.map +1 -0
- package/cjs/index.d.ts +41 -0
- package/cjs/index.js +59 -0
- package/cjs/index.js.map +1 -0
- package/cjs/rawRumEvent.types.d.ts +326 -0
- package/cjs/rawRumEvent.types.js +34 -0
- package/cjs/rawRumEvent.types.js.map +1 -0
- package/cjs/rumEvent.types.d.ts +2026 -0
- package/cjs/rumEvent.types.js +7 -0
- package/cjs/rumEvent.types.js.map +1 -0
- package/cjs/transport/formDataTransport.d.ts +16 -0
- package/cjs/transport/formDataTransport.js +46 -0
- package/cjs/transport/formDataTransport.js.map +1 -0
- package/cjs/transport/startRumBatch.d.ts +5 -0
- package/cjs/transport/startRumBatch.js +33 -0
- package/cjs/transport/startRumBatch.js.map +1 -0
- package/cjs/transport/startRumEventBridge.d.ts +2 -0
- package/cjs/transport/startRumEventBridge.js +11 -0
- package/cjs/transport/startRumEventBridge.js.map +1 -0
- package/esm/boot/preStartRum.d.ts +7 -0
- package/esm/boot/preStartRum.js +187 -0
- package/esm/boot/preStartRum.js.map +1 -0
- package/esm/boot/rumPublicApi.d.ts +409 -0
- package/esm/boot/rumPublicApi.js +165 -0
- package/esm/boot/rumPublicApi.js.map +1 -0
- package/esm/boot/startRum.d.ts +109 -0
- package/esm/boot/startRum.js +149 -0
- package/esm/boot/startRum.js.map +1 -0
- package/esm/browser/cookieObservable.d.ts +8 -0
- package/esm/browser/cookieObservable.js +35 -0
- package/esm/browser/cookieObservable.js.map +1 -0
- package/esm/browser/domMutationObservable.d.ts +27 -0
- package/esm/browser/domMutationObservable.js +54 -0
- package/esm/browser/domMutationObservable.js.map +1 -0
- package/esm/browser/firstInputPolyfill.d.ts +8 -0
- package/esm/browser/firstInputPolyfill.js +65 -0
- package/esm/browser/firstInputPolyfill.js.map +1 -0
- package/esm/browser/htmlDomUtils.d.ts +13 -0
- package/esm/browser/htmlDomUtils.js +36 -0
- package/esm/browser/htmlDomUtils.js.map +1 -0
- package/esm/browser/locationChangeObservable.d.ts +7 -0
- package/esm/browser/locationChangeObservable.js +48 -0
- package/esm/browser/locationChangeObservable.js.map +1 -0
- package/esm/browser/performanceObservable.d.ts +174 -0
- package/esm/browser/performanceObservable.js +121 -0
- package/esm/browser/performanceObservable.js.map +1 -0
- package/esm/browser/performanceUtils.d.ts +7 -0
- package/esm/browser/performanceUtils.js +38 -0
- package/esm/browser/performanceUtils.js.map +1 -0
- package/esm/browser/scroll.d.ts +2 -0
- package/esm/browser/scroll.js +29 -0
- package/esm/browser/scroll.js.map +1 -0
- package/esm/browser/viewportObservable.d.ts +10 -0
- package/esm/browser/viewportObservable.js +32 -0
- package/esm/browser/viewportObservable.js.map +1 -0
- package/esm/browser/windowOpenObservable.d.ts +5 -0
- package/esm/browser/windowOpenObservable.js +7 -0
- package/esm/browser/windowOpenObservable.js.map +1 -0
- package/esm/domain/action/actionCollection.d.ts +21 -0
- package/esm/domain/action/actionCollection.js +93 -0
- package/esm/domain/action/actionCollection.js.map +1 -0
- package/esm/domain/action/actionNameConstants.d.ts +18 -0
- package/esm/domain/action/actionNameConstants.js +8 -0
- package/esm/domain/action/actionNameConstants.js.map +1 -0
- package/esm/domain/action/clickChain.d.ts +8 -0
- package/esm/domain/action/clickChain.js +57 -0
- package/esm/domain/action/clickChain.js.map +1 -0
- package/esm/domain/action/computeFrustration.d.ts +6 -0
- package/esm/domain/action/computeFrustration.js +65 -0
- package/esm/domain/action/computeFrustration.js.map +1 -0
- package/esm/domain/action/getActionNameFromElement.d.ts +4 -0
- package/esm/domain/action/getActionNameFromElement.js +236 -0
- package/esm/domain/action/getActionNameFromElement.js.map +1 -0
- package/esm/domain/action/interactionSelectorCache.d.ts +5 -0
- package/esm/domain/action/interactionSelectorCache.js +18 -0
- package/esm/domain/action/interactionSelectorCache.js.map +1 -0
- package/esm/domain/action/listenActionEvents.d.ts +19 -0
- package/esm/domain/action/listenActionEvents.js +58 -0
- package/esm/domain/action/listenActionEvents.js.map +1 -0
- package/esm/domain/action/trackClickActions.d.ts +81 -0
- package/esm/domain/action/trackClickActions.js +232 -0
- package/esm/domain/action/trackClickActions.js.map +1 -0
- package/esm/domain/assembly.d.ts +5 -0
- package/esm/domain/assembly.js +99 -0
- package/esm/domain/assembly.js.map +1 -0
- package/esm/domain/configuration/configuration.d.ts +325 -0
- package/esm/domain/configuration/configuration.js +200 -0
- package/esm/domain/configuration/configuration.js.map +1 -0
- package/esm/domain/configuration/index.d.ts +2 -0
- package/esm/domain/configuration/index.js +3 -0
- package/esm/domain/configuration/index.js.map +1 -0
- package/esm/domain/configuration/jsonPathParser.d.ts +28 -0
- package/esm/domain/configuration/jsonPathParser.js +156 -0
- package/esm/domain/configuration/jsonPathParser.js.map +1 -0
- package/esm/domain/configuration/remoteConfiguration.d.ts +39 -0
- package/esm/domain/configuration/remoteConfiguration.js +236 -0
- package/esm/domain/configuration/remoteConfiguration.js.map +1 -0
- package/esm/domain/configuration/remoteConfiguration.types.d.ts +138 -0
- package/esm/domain/configuration/remoteConfiguration.types.js +6 -0
- package/esm/domain/configuration/remoteConfiguration.types.js.map +1 -0
- package/esm/domain/contexts/ciVisibilityContext.d.ts +12 -0
- package/esm/domain/contexts/ciVisibilityContext.js +30 -0
- package/esm/domain/contexts/ciVisibilityContext.js.map +1 -0
- package/esm/domain/contexts/connectivityContext.d.ts +2 -0
- package/esm/domain/contexts/connectivityContext.js +8 -0
- package/esm/domain/contexts/connectivityContext.js.map +1 -0
- package/esm/domain/contexts/defaultContext.d.ts +4 -0
- package/esm/domain/contexts/defaultContext.js +31 -0
- package/esm/domain/contexts/defaultContext.js.map +1 -0
- package/esm/domain/contexts/displayContext.d.ts +6 -0
- package/esm/domain/contexts/displayContext.js +25 -0
- package/esm/domain/contexts/displayContext.js.map +1 -0
- package/esm/domain/contexts/featureFlagContext.d.ts +19 -0
- package/esm/domain/contexts/featureFlagContext.js +49 -0
- package/esm/domain/contexts/featureFlagContext.js.map +1 -0
- package/esm/domain/contexts/internalContext.d.ts +12 -0
- package/esm/domain/contexts/internalContext.js +23 -0
- package/esm/domain/contexts/internalContext.js.map +1 -0
- package/esm/domain/contexts/pageStateHistory.d.ts +23 -0
- package/esm/domain/contexts/pageStateHistory.js +100 -0
- package/esm/domain/contexts/pageStateHistory.js.map +1 -0
- package/esm/domain/contexts/sessionContext.d.ts +5 -0
- package/esm/domain/contexts/sessionContext.js +44 -0
- package/esm/domain/contexts/sessionContext.js.map +1 -0
- package/esm/domain/contexts/syntheticsContext.d.ts +2 -0
- package/esm/domain/contexts/syntheticsContext.js +22 -0
- package/esm/domain/contexts/syntheticsContext.js.map +1 -0
- package/esm/domain/contexts/trackingConsentContext.d.ts +3 -0
- package/esm/domain/contexts/trackingConsentContext.js +11 -0
- package/esm/domain/contexts/trackingConsentContext.js.map +1 -0
- package/esm/domain/contexts/urlContexts.d.ts +22 -0
- package/esm/domain/contexts/urlContexts.js +60 -0
- package/esm/domain/contexts/urlContexts.js.map +1 -0
- package/esm/domain/contexts/userAgentDataContext.d.ts +2 -0
- package/esm/domain/contexts/userAgentDataContext.js +28 -0
- package/esm/domain/contexts/userAgentDataContext.js.map +1 -0
- package/esm/domain/contexts/viewHistory.d.ts +17 -0
- package/esm/domain/contexts/viewHistory.js +44 -0
- package/esm/domain/contexts/viewHistory.js.map +1 -0
- package/esm/domain/discardNegativeDuration.d.ts +2 -0
- package/esm/domain/discardNegativeDuration.js +5 -0
- package/esm/domain/discardNegativeDuration.js.map +1 -0
- package/esm/domain/error/errorCollection.d.ts +17 -0
- package/esm/domain/error/errorCollection.js +70 -0
- package/esm/domain/error/errorCollection.js.map +1 -0
- package/esm/domain/error/trackConsoleError.d.ts +4 -0
- package/esm/domain/error/trackConsoleError.js +10 -0
- package/esm/domain/error/trackConsoleError.js.map +1 -0
- package/esm/domain/error/trackReportError.d.ts +5 -0
- package/esm/domain/error/trackReportError.js +13 -0
- package/esm/domain/error/trackReportError.js.map +1 -0
- package/esm/domain/event/eventCollection.d.ts +10 -0
- package/esm/domain/event/eventCollection.js +24 -0
- package/esm/domain/event/eventCollection.js.map +1 -0
- package/esm/domain/getSelectorFromElement.d.ts +64 -0
- package/esm/domain/getSelectorFromElement.js +213 -0
- package/esm/domain/getSelectorFromElement.js.map +1 -0
- package/esm/domain/getSessionReplayUrl.d.ts +9 -0
- package/esm/domain/getSessionReplayUrl.js +30 -0
- package/esm/domain/getSessionReplayUrl.js.map +1 -0
- package/esm/domain/hooks.d.ts +23 -0
- package/esm/domain/hooks.js +3 -0
- package/esm/domain/hooks.js.map +1 -0
- package/esm/domain/lifeCycle.d.ts +73 -0
- package/esm/domain/lifeCycle.js +3 -0
- package/esm/domain/lifeCycle.js.map +1 -0
- package/esm/domain/limitModification.d.ts +8 -0
- package/esm/domain/limitModification.js +43 -0
- package/esm/domain/limitModification.js.map +1 -0
- package/esm/domain/longTask/longTaskCollection.d.ts +18 -0
- package/esm/domain/longTask/longTaskCollection.js +87 -0
- package/esm/domain/longTask/longTaskCollection.js.map +1 -0
- package/esm/domain/plugins.d.ts +40 -0
- package/esm/domain/plugins.js +12 -0
- package/esm/domain/plugins.js.map +1 -0
- package/esm/domain/privacy.d.ts +44 -0
- package/esm/domain/privacy.js +302 -0
- package/esm/domain/privacy.js.map +1 -0
- package/esm/domain/privacyConstants.d.ts +23 -0
- package/esm/domain/privacyConstants.js +35 -0
- package/esm/domain/privacyConstants.js.map +1 -0
- package/esm/domain/requestCollection.d.ts +54 -0
- package/esm/domain/requestCollection.js +106 -0
- package/esm/domain/requestCollection.js.map +1 -0
- package/esm/domain/resource/graphql.d.ts +23 -0
- package/esm/domain/resource/graphql.js +91 -0
- package/esm/domain/resource/graphql.js.map +1 -0
- package/esm/domain/resource/matchRequestResourceEntry.d.ts +16 -0
- package/esm/domain/resource/matchRequestResourceEntry.js +46 -0
- package/esm/domain/resource/matchRequestResourceEntry.js.map +1 -0
- package/esm/domain/resource/requestRegistry.d.ts +9 -0
- package/esm/domain/resource/requestRegistry.js +37 -0
- package/esm/domain/resource/requestRegistry.js.map +1 -0
- package/esm/domain/resource/resourceCollection.d.ts +7 -0
- package/esm/domain/resource/resourceCollection.js +187 -0
- package/esm/domain/resource/resourceCollection.js.map +1 -0
- package/esm/domain/resource/resourceUtils.d.ts +55 -0
- package/esm/domain/resource/resourceUtils.js +244 -0
- package/esm/domain/resource/resourceUtils.js.map +1 -0
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +4 -0
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js +21 -0
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js.map +1 -0
- package/esm/domain/rumSessionManager.d.ts +36 -0
- package/esm/domain/rumSessionManager.js +72 -0
- package/esm/domain/rumSessionManager.js.map +1 -0
- package/esm/domain/sampler/sampler.d.ts +10 -0
- package/esm/domain/sampler/sampler.js +58 -0
- package/esm/domain/sampler/sampler.js.map +1 -0
- package/esm/domain/startCustomerDataTelemetry.d.ts +4 -0
- package/esm/domain/startCustomerDataTelemetry.js +52 -0
- package/esm/domain/startCustomerDataTelemetry.js.map +1 -0
- package/esm/domain/tracing/getDocumentTraceId.d.ts +12 -0
- package/esm/domain/tracing/getDocumentTraceId.js +68 -0
- package/esm/domain/tracing/getDocumentTraceId.js.map +1 -0
- package/esm/domain/tracing/identifier.d.ts +13 -0
- package/esm/domain/tracing/identifier.js +50 -0
- package/esm/domain/tracing/identifier.js.map +1 -0
- package/esm/domain/tracing/sampler.d.ts +10 -0
- package/esm/domain/tracing/sampler.js +64 -0
- package/esm/domain/tracing/sampler.js.map +1 -0
- package/esm/domain/tracing/tracer.d.ts +30 -0
- package/esm/domain/tracing/tracer.js +156 -0
- package/esm/domain/tracing/tracer.js.map +1 -0
- package/esm/domain/tracing/tracer.types.d.ts +12 -0
- package/esm/domain/tracing/tracer.types.js +2 -0
- package/esm/domain/tracing/tracer.types.js.map +1 -0
- package/esm/domain/trackEventCounts.d.ts +17 -0
- package/esm/domain/trackEventCounts.js +47 -0
- package/esm/domain/trackEventCounts.js.map +1 -0
- package/esm/domain/view/bfCacheSupport.d.ts +2 -0
- package/esm/domain/view/bfCacheSupport.js +10 -0
- package/esm/domain/view/bfCacheSupport.js.map +1 -0
- package/esm/domain/view/trackViewEventCounts.d.ts +5 -0
- package/esm/domain/view/trackViewEventCounts.js +13 -0
- package/esm/domain/view/trackViewEventCounts.js.map +1 -0
- package/esm/domain/view/trackViews.d.ts +65 -0
- package/esm/domain/view/trackViews.js +271 -0
- package/esm/domain/view/trackViews.js.map +1 -0
- package/esm/domain/view/viewCollection.d.ts +18 -0
- package/esm/domain/view/viewCollection.js +150 -0
- package/esm/domain/view/viewCollection.js.map +1 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.d.ts +6 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js +28 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +1 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.d.ts +18 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.js +39 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.js.map +1 -0
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +6 -0
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +41 -0
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +8 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js +14 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +21 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js +34 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +37 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js +130 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +13 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js +34 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.d.ts +10 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.js +30 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstInput.d.ts +19 -0
- package/esm/domain/view/viewMetrics/trackFirstInput.js +40 -0
- package/esm/domain/view/viewMetrics/trackFirstInput.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +15 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js +38 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +25 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js +149 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +18 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js +57 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.d.ts +14 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.js +47 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.d.ts +14 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.js +40 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.d.ts +25 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.js +72 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.js.map +1 -0
- package/esm/domain/vital/vitalCollection.d.ts +55 -0
- package/esm/domain/vital/vitalCollection.js +107 -0
- package/esm/domain/vital/vitalCollection.js.map +1 -0
- package/esm/domain/waitPageActivityEnd.d.ts +54 -0
- package/esm/domain/waitPageActivityEnd.js +123 -0
- package/esm/domain/waitPageActivityEnd.js.map +1 -0
- package/esm/domainContext.types.d.ts +39 -0
- package/esm/domainContext.types.js +5 -0
- package/esm/domainContext.types.js.map +1 -0
- package/esm/index.d.ts +41 -0
- package/esm/index.js +21 -0
- package/esm/index.js.map +1 -0
- package/esm/rawRumEvent.types.d.ts +326 -0
- package/esm/rawRumEvent.types.js +31 -0
- package/esm/rawRumEvent.types.js.map +1 -0
- package/esm/rumEvent.types.d.ts +2026 -0
- package/esm/rumEvent.types.js +6 -0
- package/esm/rumEvent.types.js.map +1 -0
- package/esm/transport/formDataTransport.d.ts +16 -0
- package/esm/transport/formDataTransport.js +43 -0
- package/esm/transport/formDataTransport.js.map +1 -0
- package/esm/transport/startRumBatch.d.ts +5 -0
- package/esm/transport/startRumBatch.js +30 -0
- package/esm/transport/startRumBatch.js.map +1 -0
- package/esm/transport/startRumEventBridge.d.ts +2 -0
- package/esm/transport/startRumEventBridge.js +8 -0
- package/esm/transport/startRumEventBridge.js.map +1 -0
- package/package.json +29 -0
- package/src/boot/preStartRum.ts +298 -0
- package/src/boot/rumPublicApi.ts +830 -0
- package/src/boot/startRum.ts +280 -0
- package/src/browser/cookieObservable.ts +63 -0
- package/src/browser/domMutationObservable.ts +98 -0
- package/src/browser/firstInputPolyfill.ts +87 -0
- package/src/browser/htmlDomUtils.ts +45 -0
- package/src/browser/locationChangeObservable.ts +69 -0
- package/src/browser/performanceObservable.ts +324 -0
- package/src/browser/performanceUtils.ts +50 -0
- package/src/browser/scroll.ts +25 -0
- package/src/browser/viewportObservable.ts +44 -0
- package/src/browser/windowOpenObservable.ts +7 -0
- package/src/domain/action/actionCollection.ts +146 -0
- package/src/domain/action/actionNameConstants.ts +20 -0
- package/src/domain/action/clickChain.ts +83 -0
- package/src/domain/action/computeFrustration.ts +77 -0
- package/src/domain/action/getActionNameFromElement.ts +337 -0
- package/src/domain/action/interactionSelectorCache.ts +21 -0
- package/src/domain/action/listenActionEvents.ts +119 -0
- package/src/domain/action/trackClickActions.ts +388 -0
- package/src/domain/assembly.ts +141 -0
- package/src/domain/configuration/configuration.ts +548 -0
- package/src/domain/configuration/index.ts +2 -0
- package/src/domain/configuration/jsonPathParser.ts +214 -0
- package/src/domain/configuration/remoteConfiguration.ts +304 -0
- package/src/domain/configuration/remoteConfiguration.types.ts +147 -0
- package/src/domain/contexts/ciVisibilityContext.ts +50 -0
- package/src/domain/contexts/connectivityContext.ts +12 -0
- package/src/domain/contexts/defaultContext.ts +43 -0
- package/src/domain/contexts/displayContext.ts +38 -0
- package/src/domain/contexts/featureFlagContext.ts +71 -0
- package/src/domain/contexts/internalContext.ts +34 -0
- package/src/domain/contexts/pageStateHistory.ts +171 -0
- package/src/domain/contexts/sessionContext.ts +59 -0
- package/src/domain/contexts/syntheticsContext.ts +33 -0
- package/src/domain/contexts/trackingConsentContext.ts +15 -0
- package/src/domain/contexts/urlContexts.ts +97 -0
- package/src/domain/contexts/userAgentDataContext.ts +36 -0
- package/src/domain/contexts/viewHistory.ts +70 -0
- package/src/domain/discardNegativeDuration.ts +6 -0
- package/src/domain/error/errorCollection.ts +107 -0
- package/src/domain/error/trackConsoleError.ts +14 -0
- package/src/domain/error/trackReportError.ts +16 -0
- package/src/domain/event/eventCollection.ts +53 -0
- package/src/domain/getSelectorFromElement.ts +268 -0
- package/src/domain/getSessionReplayUrl.ts +47 -0
- package/src/domain/hooks.ts +31 -0
- package/src/domain/lifeCycle.ts +103 -0
- package/src/domain/limitModification.ts +66 -0
- package/src/domain/longTask/longTaskCollection.ts +133 -0
- package/src/domain/plugins.ts +59 -0
- package/src/domain/privacy.ts +355 -0
- package/src/domain/privacyConstants.ts +43 -0
- package/src/domain/requestCollection.ts +179 -0
- package/src/domain/resource/graphql.ts +135 -0
- package/src/domain/resource/matchRequestResourceEntry.ts +68 -0
- package/src/domain/resource/requestRegistry.ts +52 -0
- package/src/domain/resource/resourceCollection.ts +273 -0
- package/src/domain/resource/resourceUtils.ts +355 -0
- package/src/domain/resource/retrieveInitialDocumentResourceTiming.ts +27 -0
- package/src/domain/rumSessionManager.ts +134 -0
- package/src/domain/sampler/sampler.ts +63 -0
- package/src/domain/startCustomerDataTelemetry.ts +83 -0
- package/src/domain/tracing/getDocumentTraceId.ts +90 -0
- package/src/domain/tracing/identifier.ts +69 -0
- package/src/domain/tracing/sampler.ts +69 -0
- package/src/domain/tracing/tracer.ts +248 -0
- package/src/domain/tracing/tracer.types.ts +13 -0
- package/src/domain/trackEventCounts.ts +67 -0
- package/src/domain/view/bfCacheSupport.ts +20 -0
- package/src/domain/view/trackViewEventCounts.ts +15 -0
- package/src/domain/view/trackViews.ts +431 -0
- package/src/domain/view/viewCollection.ts +203 -0
- package/src/domain/view/viewMetrics/getClsAttributionImpactedArea.ts +34 -0
- package/src/domain/view/viewMetrics/interactionCountPolyfill.ts +55 -0
- package/src/domain/view/viewMetrics/startInitialViewMetricsTelemetry.ts +70 -0
- package/src/domain/view/viewMetrics/trackBfcacheMetrics.ts +20 -0
- package/src/domain/view/viewMetrics/trackCommonViewMetrics.ts +78 -0
- package/src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts +180 -0
- package/src/domain/view/viewMetrics/trackFirstContentfulPaint.ts +47 -0
- package/src/domain/view/viewMetrics/trackFirstHidden.ts +53 -0
- package/src/domain/view/viewMetrics/trackFirstInput.ts +59 -0
- package/src/domain/view/viewMetrics/trackInitialViewMetrics.ts +66 -0
- package/src/domain/view/viewMetrics/trackInteractionToNextPaint.ts +193 -0
- package/src/domain/view/viewMetrics/trackLargestContentfulPaint.ts +87 -0
- package/src/domain/view/viewMetrics/trackLoadingTime.ts +69 -0
- package/src/domain/view/viewMetrics/trackNavigationTimings.ts +66 -0
- package/src/domain/view/viewMetrics/trackScrollMetrics.ts +119 -0
- package/src/domain/vital/vitalCollection.ts +207 -0
- package/src/domain/waitPageActivityEnd.ts +189 -0
- package/src/domainContext.types.ts +61 -0
- package/src/index.ts +76 -0
- package/src/rawRumEvent.types.ts +409 -0
- package/src/rumEvent.types.ts +2151 -0
- package/src/transport/formDataTransport.ts +85 -0
- package/src/transport/startRumBatch.ts +46 -0
- package/src/transport/startRumEventBridge.ts +12 -0
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Duration,
|
|
3
|
+
ClocksState,
|
|
4
|
+
TimeStamp,
|
|
5
|
+
Subscription,
|
|
6
|
+
RelativeTime,
|
|
7
|
+
Context,
|
|
8
|
+
ContextValue,
|
|
9
|
+
} from '@kubesense/kubesense-browser-core'
|
|
10
|
+
import {
|
|
11
|
+
noop,
|
|
12
|
+
PageExitReason,
|
|
13
|
+
shallowClone,
|
|
14
|
+
elapsed,
|
|
15
|
+
generateUUID,
|
|
16
|
+
ONE_MINUTE,
|
|
17
|
+
throttle,
|
|
18
|
+
clocksNow,
|
|
19
|
+
clocksOrigin,
|
|
20
|
+
relativeToClocks,
|
|
21
|
+
timeStampNow,
|
|
22
|
+
display,
|
|
23
|
+
looksLikeRelativeTime,
|
|
24
|
+
setInterval,
|
|
25
|
+
clearInterval,
|
|
26
|
+
setTimeout,
|
|
27
|
+
Observable,
|
|
28
|
+
createContextManager,
|
|
29
|
+
} from '@kubesense/kubesense-browser-core'
|
|
30
|
+
import type { ViewCustomTimings } from '../../rawRumEvent.types'
|
|
31
|
+
import { ViewLoadingType } from '../../rawRumEvent.types'
|
|
32
|
+
import type { LifeCycle } from '../lifeCycle'
|
|
33
|
+
import { LifeCycleEventType } from '../lifeCycle'
|
|
34
|
+
import type { EventCounts } from '../trackEventCounts'
|
|
35
|
+
import type { LocationChange } from '../../browser/locationChangeObservable'
|
|
36
|
+
import type { RumConfiguration, RumInitConfiguration } from '../configuration'
|
|
37
|
+
import type { RumMutationRecord } from '../../browser/domMutationObservable'
|
|
38
|
+
import { trackViewEventCounts } from './trackViewEventCounts'
|
|
39
|
+
import { trackInitialViewMetrics } from './viewMetrics/trackInitialViewMetrics'
|
|
40
|
+
import type { InitialViewMetrics } from './viewMetrics/trackInitialViewMetrics'
|
|
41
|
+
import type { CommonViewMetrics } from './viewMetrics/trackCommonViewMetrics'
|
|
42
|
+
import { trackCommonViewMetrics } from './viewMetrics/trackCommonViewMetrics'
|
|
43
|
+
import { onBFCacheRestore } from './bfCacheSupport'
|
|
44
|
+
import { trackBfcacheMetrics } from './viewMetrics/trackBfcacheMetrics'
|
|
45
|
+
|
|
46
|
+
export interface ViewEvent {
|
|
47
|
+
id: string
|
|
48
|
+
name?: string
|
|
49
|
+
service?: string
|
|
50
|
+
version?: string
|
|
51
|
+
context?: Context
|
|
52
|
+
location: Readonly<Location>
|
|
53
|
+
commonViewMetrics: CommonViewMetrics
|
|
54
|
+
initialViewMetrics: InitialViewMetrics
|
|
55
|
+
customTimings: ViewCustomTimings
|
|
56
|
+
eventCounts: EventCounts
|
|
57
|
+
documentVersion: number
|
|
58
|
+
startClocks: ClocksState
|
|
59
|
+
duration: Duration
|
|
60
|
+
isActive: boolean
|
|
61
|
+
sessionIsActive: boolean
|
|
62
|
+
loadingType: ViewLoadingType
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface ViewCreatedEvent {
|
|
66
|
+
id: string
|
|
67
|
+
name?: string
|
|
68
|
+
service?: string
|
|
69
|
+
version?: string
|
|
70
|
+
context?: Context
|
|
71
|
+
startClocks: ClocksState
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface BeforeViewUpdateEvent {
|
|
75
|
+
id: string
|
|
76
|
+
name?: string
|
|
77
|
+
context?: Context
|
|
78
|
+
startClocks: ClocksState
|
|
79
|
+
sessionIsActive: boolean
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface ViewEndedEvent {
|
|
83
|
+
endClocks: ClocksState
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const THROTTLE_VIEW_UPDATE_PERIOD = 3000
|
|
87
|
+
export const SESSION_KEEP_ALIVE_INTERVAL = 5 * ONE_MINUTE
|
|
88
|
+
|
|
89
|
+
// Some events or metrics can be captured after the end of the view. To avoid missing those;
|
|
90
|
+
// an arbitrary delay is added for stopping their tracking after the view ends.
|
|
91
|
+
//
|
|
92
|
+
// Ideally, we would not stop and keep tracking events or metrics until the end of the session.
|
|
93
|
+
// But this might have a small performance impact if there are many many views.
|
|
94
|
+
// So let's have a fairly short delay improving the situation in most cases and avoid impacting performances too much.
|
|
95
|
+
export const KEEP_TRACKING_AFTER_VIEW_DELAY = 5 * ONE_MINUTE
|
|
96
|
+
|
|
97
|
+
export interface ViewOptions {
|
|
98
|
+
name?: string
|
|
99
|
+
service?: RumInitConfiguration['service']
|
|
100
|
+
version?: RumInitConfiguration['version']
|
|
101
|
+
context?: Context
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function trackViews(
|
|
105
|
+
location: Location,
|
|
106
|
+
lifeCycle: LifeCycle,
|
|
107
|
+
domMutationObservable: Observable<RumMutationRecord[]>,
|
|
108
|
+
windowOpenObservable: Observable<void>,
|
|
109
|
+
configuration: RumConfiguration,
|
|
110
|
+
locationChangeObservable: Observable<LocationChange>,
|
|
111
|
+
areViewsTrackedAutomatically: boolean,
|
|
112
|
+
initialViewOptions?: ViewOptions
|
|
113
|
+
) {
|
|
114
|
+
const activeViews: Set<ReturnType<typeof newView>> = new Set()
|
|
115
|
+
let currentView = startNewView(ViewLoadingType.INITIAL_LOAD, clocksOrigin(), initialViewOptions)
|
|
116
|
+
let stopOnBFCacheRestore: (() => void) | undefined
|
|
117
|
+
|
|
118
|
+
startViewLifeCycle()
|
|
119
|
+
|
|
120
|
+
let locationChangeSubscription: Subscription
|
|
121
|
+
if (areViewsTrackedAutomatically) {
|
|
122
|
+
locationChangeSubscription = renewViewOnLocationChange(locationChangeObservable)
|
|
123
|
+
if (configuration.trackBfcacheViews) {
|
|
124
|
+
stopOnBFCacheRestore = onBFCacheRestore(configuration, (pageshowEvent) => {
|
|
125
|
+
currentView.end()
|
|
126
|
+
const startClocks = relativeToClocks(pageshowEvent.timeStamp as RelativeTime)
|
|
127
|
+
currentView = startNewView(ViewLoadingType.BF_CACHE, startClocks, undefined)
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function startNewView(loadingType: ViewLoadingType, startClocks?: ClocksState, viewOptions?: ViewOptions) {
|
|
133
|
+
const newlyCreatedView = newView(
|
|
134
|
+
lifeCycle,
|
|
135
|
+
domMutationObservable,
|
|
136
|
+
windowOpenObservable,
|
|
137
|
+
configuration,
|
|
138
|
+
location,
|
|
139
|
+
loadingType,
|
|
140
|
+
startClocks,
|
|
141
|
+
viewOptions
|
|
142
|
+
)
|
|
143
|
+
activeViews.add(newlyCreatedView)
|
|
144
|
+
newlyCreatedView.stopObservable.subscribe(() => {
|
|
145
|
+
activeViews.delete(newlyCreatedView)
|
|
146
|
+
})
|
|
147
|
+
return newlyCreatedView
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function startViewLifeCycle() {
|
|
151
|
+
lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, () => {
|
|
152
|
+
// Renew view on session renewal
|
|
153
|
+
currentView = startNewView(ViewLoadingType.ROUTE_CHANGE, undefined, {
|
|
154
|
+
name: currentView.name,
|
|
155
|
+
service: currentView.service,
|
|
156
|
+
version: currentView.version,
|
|
157
|
+
context: currentView.contextManager.getContext(),
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
lifeCycle.subscribe(LifeCycleEventType.SESSION_EXPIRED, () => {
|
|
162
|
+
currentView.end({ sessionIsActive: false })
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function renewViewOnLocationChange(locationChangeObservable: Observable<LocationChange>) {
|
|
167
|
+
return locationChangeObservable.subscribe(({ oldLocation, newLocation }) => {
|
|
168
|
+
if (areDifferentLocation(oldLocation, newLocation)) {
|
|
169
|
+
currentView.end()
|
|
170
|
+
currentView = startNewView(ViewLoadingType.ROUTE_CHANGE)
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
addTiming: (name: string, time: RelativeTime | TimeStamp = timeStampNow()) => {
|
|
177
|
+
currentView.addTiming(name, time)
|
|
178
|
+
},
|
|
179
|
+
startView: (options?: ViewOptions, startClocks?: ClocksState) => {
|
|
180
|
+
currentView.end({ endClocks: startClocks })
|
|
181
|
+
currentView = startNewView(ViewLoadingType.ROUTE_CHANGE, startClocks, options)
|
|
182
|
+
},
|
|
183
|
+
setViewContext: (context: Context) => {
|
|
184
|
+
currentView.contextManager.setContext(context)
|
|
185
|
+
},
|
|
186
|
+
setViewContextProperty: (key: string, value: ContextValue) => {
|
|
187
|
+
currentView.contextManager.setContextProperty(key, value)
|
|
188
|
+
},
|
|
189
|
+
setViewName: (name: string) => {
|
|
190
|
+
currentView.setViewName(name)
|
|
191
|
+
},
|
|
192
|
+
getViewContext: () => currentView.contextManager.getContext(),
|
|
193
|
+
|
|
194
|
+
stop: () => {
|
|
195
|
+
if (locationChangeSubscription) {
|
|
196
|
+
locationChangeSubscription.unsubscribe()
|
|
197
|
+
}
|
|
198
|
+
if (stopOnBFCacheRestore) {
|
|
199
|
+
stopOnBFCacheRestore()
|
|
200
|
+
}
|
|
201
|
+
currentView.end()
|
|
202
|
+
activeViews.forEach((view) => view.stop())
|
|
203
|
+
},
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function newView(
|
|
208
|
+
lifeCycle: LifeCycle,
|
|
209
|
+
domMutationObservable: Observable<RumMutationRecord[]>,
|
|
210
|
+
windowOpenObservable: Observable<void>,
|
|
211
|
+
configuration: RumConfiguration,
|
|
212
|
+
initialLocation: Location,
|
|
213
|
+
loadingType: ViewLoadingType,
|
|
214
|
+
startClocks: ClocksState = clocksNow(),
|
|
215
|
+
viewOptions?: ViewOptions
|
|
216
|
+
) {
|
|
217
|
+
// Setup initial values
|
|
218
|
+
const id = generateUUID()
|
|
219
|
+
const stopObservable = new Observable<void>()
|
|
220
|
+
const customTimings: ViewCustomTimings = {}
|
|
221
|
+
let documentVersion = 0
|
|
222
|
+
let endClocks: ClocksState | undefined
|
|
223
|
+
const location = shallowClone(initialLocation)
|
|
224
|
+
const contextManager = createContextManager()
|
|
225
|
+
|
|
226
|
+
let sessionIsActive = true
|
|
227
|
+
let name = viewOptions?.name
|
|
228
|
+
const service = viewOptions?.service || configuration.service
|
|
229
|
+
const version = viewOptions?.version || configuration.version
|
|
230
|
+
const context = viewOptions?.context
|
|
231
|
+
|
|
232
|
+
if (context) {
|
|
233
|
+
contextManager.setContext(context)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const viewCreatedEvent = {
|
|
237
|
+
id,
|
|
238
|
+
name,
|
|
239
|
+
startClocks,
|
|
240
|
+
service,
|
|
241
|
+
version,
|
|
242
|
+
context,
|
|
243
|
+
}
|
|
244
|
+
lifeCycle.notify(LifeCycleEventType.BEFORE_VIEW_CREATED, viewCreatedEvent)
|
|
245
|
+
lifeCycle.notify(LifeCycleEventType.VIEW_CREATED, viewCreatedEvent)
|
|
246
|
+
|
|
247
|
+
// Update the view every time the measures are changing
|
|
248
|
+
const { throttled, cancel: cancelScheduleViewUpdate } = throttle(triggerViewUpdate, THROTTLE_VIEW_UPDATE_PERIOD, {
|
|
249
|
+
leading: false,
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
const {
|
|
253
|
+
setLoadEvent,
|
|
254
|
+
setViewEnd,
|
|
255
|
+
stop: stopCommonViewMetricsTracking,
|
|
256
|
+
stopINPTracking,
|
|
257
|
+
getCommonViewMetrics,
|
|
258
|
+
} = trackCommonViewMetrics(
|
|
259
|
+
lifeCycle,
|
|
260
|
+
domMutationObservable,
|
|
261
|
+
windowOpenObservable,
|
|
262
|
+
configuration,
|
|
263
|
+
scheduleViewUpdate,
|
|
264
|
+
loadingType,
|
|
265
|
+
startClocks
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
const { stop: stopInitialViewMetricsTracking, initialViewMetrics } =
|
|
269
|
+
loadingType === ViewLoadingType.INITIAL_LOAD
|
|
270
|
+
? trackInitialViewMetrics(configuration, startClocks, setLoadEvent, scheduleViewUpdate)
|
|
271
|
+
: { stop: noop, initialViewMetrics: {} as InitialViewMetrics }
|
|
272
|
+
|
|
273
|
+
// Start BFCache-specific metrics when restoring from BFCache
|
|
274
|
+
if (loadingType === ViewLoadingType.BF_CACHE) {
|
|
275
|
+
trackBfcacheMetrics(startClocks, initialViewMetrics, scheduleViewUpdate)
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const { stop: stopEventCountsTracking, eventCounts } = trackViewEventCounts(lifeCycle, id, scheduleViewUpdate)
|
|
279
|
+
|
|
280
|
+
// Session keep alive
|
|
281
|
+
const keepAliveIntervalId = setInterval(triggerViewUpdate, SESSION_KEEP_ALIVE_INTERVAL)
|
|
282
|
+
|
|
283
|
+
const pageMayExitSubscription = lifeCycle.subscribe(LifeCycleEventType.PAGE_MAY_EXIT, (pageMayExitEvent) => {
|
|
284
|
+
if (pageMayExitEvent.reason === PageExitReason.UNLOADING) {
|
|
285
|
+
// Force the final emission's isActive=false without mutating endClocks.
|
|
286
|
+
// Why this matters: the regular triggerViewUpdate computes
|
|
287
|
+
// `isActive: endClocks === undefined`, which is `true` here because we
|
|
288
|
+
// haven't called end(). If we leave the final pre-unload event with
|
|
289
|
+
// isActive=true the view sits in rum_view_raw permanently active —
|
|
290
|
+
// the backend cron only aggregates inactive views, so the view stays
|
|
291
|
+
// invisible to rum_view (and session aggregations) until a 10-minute
|
|
292
|
+
// stale-view fallback force-finalizes it.
|
|
293
|
+
// Why not just set endClocks here: beforeunload is not guaranteed to
|
|
294
|
+
// be followed by an actual unload (the user can cancel navigation in
|
|
295
|
+
// some flows). If we permanently set endClocks, setViewEnd() would
|
|
296
|
+
// also fire — which calls stopViewInteractionCount() and stops INP /
|
|
297
|
+
// interaction tracking for the rest of the page's life, and any later
|
|
298
|
+
// addTiming() calls are silently dropped (see the endClocks guard in
|
|
299
|
+
// addTiming). Forcing the override only on this one emission keeps
|
|
300
|
+
// the view fully recoverable if the page survives.
|
|
301
|
+
triggerViewUpdate(true)
|
|
302
|
+
}
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
// Initial view update
|
|
306
|
+
triggerViewUpdate()
|
|
307
|
+
|
|
308
|
+
// View context update should always be throttled
|
|
309
|
+
contextManager.changeObservable.subscribe(scheduleViewUpdate)
|
|
310
|
+
|
|
311
|
+
function triggerBeforeViewUpdate() {
|
|
312
|
+
lifeCycle.notify(LifeCycleEventType.BEFORE_VIEW_UPDATED, {
|
|
313
|
+
id,
|
|
314
|
+
name,
|
|
315
|
+
context: contextManager.getContext(),
|
|
316
|
+
startClocks,
|
|
317
|
+
sessionIsActive,
|
|
318
|
+
})
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function scheduleViewUpdate() {
|
|
322
|
+
triggerBeforeViewUpdate()
|
|
323
|
+
throttled()
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function triggerViewUpdate(forceInactive = false) {
|
|
327
|
+
cancelScheduleViewUpdate()
|
|
328
|
+
triggerBeforeViewUpdate()
|
|
329
|
+
|
|
330
|
+
documentVersion += 1
|
|
331
|
+
const currentEnd = endClocks === undefined ? timeStampNow() : endClocks.timeStamp
|
|
332
|
+
lifeCycle.notify(LifeCycleEventType.VIEW_UPDATED, {
|
|
333
|
+
customTimings,
|
|
334
|
+
documentVersion,
|
|
335
|
+
id,
|
|
336
|
+
name,
|
|
337
|
+
service,
|
|
338
|
+
version,
|
|
339
|
+
context: contextManager.getContext(),
|
|
340
|
+
loadingType,
|
|
341
|
+
location,
|
|
342
|
+
startClocks,
|
|
343
|
+
commonViewMetrics: getCommonViewMetrics(),
|
|
344
|
+
initialViewMetrics,
|
|
345
|
+
duration: elapsed(startClocks.timeStamp, currentEnd),
|
|
346
|
+
// forceInactive is set by the page-unload handler so the final emission
|
|
347
|
+
// is marked inactive without permanently ending the view (see comment
|
|
348
|
+
// there). All other call sites use the natural endClocks-based check.
|
|
349
|
+
isActive: !forceInactive && endClocks === undefined,
|
|
350
|
+
sessionIsActive,
|
|
351
|
+
eventCounts,
|
|
352
|
+
})
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
return {
|
|
356
|
+
get name() {
|
|
357
|
+
return name
|
|
358
|
+
},
|
|
359
|
+
service,
|
|
360
|
+
version,
|
|
361
|
+
contextManager,
|
|
362
|
+
stopObservable,
|
|
363
|
+
end(options: { endClocks?: ClocksState; sessionIsActive?: boolean } = {}) {
|
|
364
|
+
if (endClocks) {
|
|
365
|
+
// view already ended
|
|
366
|
+
return
|
|
367
|
+
}
|
|
368
|
+
endClocks = options.endClocks ?? clocksNow()
|
|
369
|
+
sessionIsActive = options.sessionIsActive ?? true
|
|
370
|
+
|
|
371
|
+
lifeCycle.notify(LifeCycleEventType.VIEW_ENDED, { endClocks })
|
|
372
|
+
lifeCycle.notify(LifeCycleEventType.AFTER_VIEW_ENDED, { endClocks })
|
|
373
|
+
clearInterval(keepAliveIntervalId)
|
|
374
|
+
setViewEnd(endClocks.relative)
|
|
375
|
+
stopCommonViewMetricsTracking()
|
|
376
|
+
pageMayExitSubscription.unsubscribe()
|
|
377
|
+
triggerViewUpdate()
|
|
378
|
+
setTimeout(() => {
|
|
379
|
+
this.stop()
|
|
380
|
+
}, KEEP_TRACKING_AFTER_VIEW_DELAY)
|
|
381
|
+
},
|
|
382
|
+
stop() {
|
|
383
|
+
stopInitialViewMetricsTracking()
|
|
384
|
+
stopEventCountsTracking()
|
|
385
|
+
stopINPTracking()
|
|
386
|
+
stopObservable.notify()
|
|
387
|
+
},
|
|
388
|
+
addTiming(name: string, time: RelativeTime | TimeStamp) {
|
|
389
|
+
if (endClocks) {
|
|
390
|
+
return
|
|
391
|
+
}
|
|
392
|
+
const relativeTime = looksLikeRelativeTime(time) ? time : elapsed(startClocks.timeStamp, time)
|
|
393
|
+
customTimings[sanitizeTiming(name)] = relativeTime
|
|
394
|
+
scheduleViewUpdate()
|
|
395
|
+
},
|
|
396
|
+
setViewName(updatedName: string) {
|
|
397
|
+
name = updatedName
|
|
398
|
+
triggerViewUpdate()
|
|
399
|
+
},
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Timing name is used as facet path that must contain only letters, digits, or the characters - _ . @ $
|
|
405
|
+
*/
|
|
406
|
+
function sanitizeTiming(name: string) {
|
|
407
|
+
const sanitized = name.replace(/[^a-zA-Z0-9-_.@$]/g, '_')
|
|
408
|
+
if (sanitized !== name) {
|
|
409
|
+
display.warn(`Invalid timing name: ${name}, sanitized to: ${sanitized}`)
|
|
410
|
+
}
|
|
411
|
+
return sanitized
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
function areDifferentLocation(currentLocation: Location, otherLocation: Location) {
|
|
415
|
+
return (
|
|
416
|
+
currentLocation.pathname !== otherLocation.pathname ||
|
|
417
|
+
(!isHashAnAnchor(otherLocation.hash) &&
|
|
418
|
+
getPathFromHash(otherLocation.hash) !== getPathFromHash(currentLocation.hash))
|
|
419
|
+
)
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
function isHashAnAnchor(hash: string) {
|
|
423
|
+
const correspondingId = hash.substring(1)
|
|
424
|
+
// check if the correspondingId is empty because on Firefox an empty string passed to getElementById() prints a consol warning
|
|
425
|
+
return correspondingId !== '' && !!document.getElementById(correspondingId)
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function getPathFromHash(hash: string) {
|
|
429
|
+
const index = hash.indexOf('?')
|
|
430
|
+
return index < 0 ? hash : hash.slice(0, index)
|
|
431
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import type { Duration, ServerDuration, Observable } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import { getTimeZone, DISCARDED, HookNames, isEmptyObject, mapValues, toServerDuration } from '@kubesense/kubesense-browser-core'
|
|
3
|
+
import { discardNegativeDuration } from '../discardNegativeDuration'
|
|
4
|
+
import type { RecorderApi } from '../../boot/rumPublicApi'
|
|
5
|
+
import type { RawRumViewEvent, ViewPerformanceData } from '../../rawRumEvent.types'
|
|
6
|
+
import { RumEventType } from '../../rawRumEvent.types'
|
|
7
|
+
import type { LifeCycle, RawRumEventCollectedData } from '../lifeCycle'
|
|
8
|
+
import { LifeCycleEventType } from '../lifeCycle'
|
|
9
|
+
import type { LocationChange } from '../../browser/locationChangeObservable'
|
|
10
|
+
import type { RumConfiguration } from '../configuration'
|
|
11
|
+
import type { ViewHistory } from '../contexts/viewHistory'
|
|
12
|
+
import type { DefaultRumEventAttributes, DefaultTelemetryEventAttributes, Hooks } from '../hooks'
|
|
13
|
+
import type { RumMutationRecord } from '../../browser/domMutationObservable'
|
|
14
|
+
import { trackViews } from './trackViews'
|
|
15
|
+
import type { ViewEvent, ViewOptions } from './trackViews'
|
|
16
|
+
import type { CommonViewMetrics } from './viewMetrics/trackCommonViewMetrics'
|
|
17
|
+
import type { InitialViewMetrics } from './viewMetrics/trackInitialViewMetrics'
|
|
18
|
+
|
|
19
|
+
export function startViewCollection(
|
|
20
|
+
lifeCycle: LifeCycle,
|
|
21
|
+
hooks: Hooks,
|
|
22
|
+
configuration: RumConfiguration,
|
|
23
|
+
location: Location,
|
|
24
|
+
domMutationObservable: Observable<RumMutationRecord[]>,
|
|
25
|
+
pageOpenObservable: Observable<void>,
|
|
26
|
+
locationChangeObservable: Observable<LocationChange>,
|
|
27
|
+
recorderApi: RecorderApi,
|
|
28
|
+
viewHistory: ViewHistory,
|
|
29
|
+
initialViewOptions?: ViewOptions
|
|
30
|
+
) {
|
|
31
|
+
lifeCycle.subscribe(LifeCycleEventType.VIEW_UPDATED, (view) =>
|
|
32
|
+
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processViewUpdate(view, configuration, recorderApi))
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
hooks.register(HookNames.Assemble, ({ startTime, eventType }): DefaultRumEventAttributes | DISCARDED => {
|
|
36
|
+
const view = viewHistory.findView(startTime)
|
|
37
|
+
|
|
38
|
+
if (!view) {
|
|
39
|
+
return DISCARDED
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
type: eventType,
|
|
44
|
+
service: view.service,
|
|
45
|
+
version: view.version,
|
|
46
|
+
context: view.context,
|
|
47
|
+
view: {
|
|
48
|
+
id: view.id,
|
|
49
|
+
name: view.name,
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
hooks.register(
|
|
55
|
+
HookNames.AssembleTelemetry,
|
|
56
|
+
({ startTime }): DefaultTelemetryEventAttributes => ({
|
|
57
|
+
view: {
|
|
58
|
+
id: viewHistory.findView(startTime)?.id,
|
|
59
|
+
},
|
|
60
|
+
})
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
return trackViews(
|
|
64
|
+
location,
|
|
65
|
+
lifeCycle,
|
|
66
|
+
domMutationObservable,
|
|
67
|
+
pageOpenObservable,
|
|
68
|
+
configuration,
|
|
69
|
+
locationChangeObservable,
|
|
70
|
+
!configuration.trackViewsManually,
|
|
71
|
+
initialViewOptions
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function processViewUpdate(
|
|
76
|
+
view: ViewEvent,
|
|
77
|
+
configuration: RumConfiguration,
|
|
78
|
+
recorderApi: RecorderApi
|
|
79
|
+
): RawRumEventCollectedData<RawRumViewEvent> {
|
|
80
|
+
const replayStats = recorderApi.getReplayStats(view.id)
|
|
81
|
+
const clsDevicePixelRatio = view.commonViewMetrics?.cumulativeLayoutShift?.devicePixelRatio
|
|
82
|
+
const viewEvent: RawRumViewEvent = {
|
|
83
|
+
_kubesense: {
|
|
84
|
+
document_version: view.documentVersion,
|
|
85
|
+
replay_stats: replayStats,
|
|
86
|
+
cls: clsDevicePixelRatio
|
|
87
|
+
? {
|
|
88
|
+
device_pixel_ratio: clsDevicePixelRatio,
|
|
89
|
+
}
|
|
90
|
+
: undefined,
|
|
91
|
+
configuration: {
|
|
92
|
+
start_session_replay_recording_manually: configuration.startSessionReplayRecordingManually,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
date: view.startClocks.timeStamp,
|
|
96
|
+
type: RumEventType.VIEW,
|
|
97
|
+
view: {
|
|
98
|
+
action: {
|
|
99
|
+
count: view.eventCounts.actionCount,
|
|
100
|
+
},
|
|
101
|
+
frustration: {
|
|
102
|
+
count: view.eventCounts.frustrationCount,
|
|
103
|
+
},
|
|
104
|
+
cumulative_layout_shift: view.commonViewMetrics.cumulativeLayoutShift?.value,
|
|
105
|
+
cumulative_layout_shift_time: toServerDuration(view.commonViewMetrics.cumulativeLayoutShift?.time),
|
|
106
|
+
cumulative_layout_shift_target_selector: view.commonViewMetrics.cumulativeLayoutShift?.targetSelector,
|
|
107
|
+
first_byte: toServerDuration(view.initialViewMetrics.navigationTimings?.firstByte),
|
|
108
|
+
dom_complete: toServerDuration(view.initialViewMetrics.navigationTimings?.domComplete),
|
|
109
|
+
dom_content_loaded: toServerDuration(view.initialViewMetrics.navigationTimings?.domContentLoaded),
|
|
110
|
+
dom_interactive: toServerDuration(view.initialViewMetrics.navigationTimings?.domInteractive),
|
|
111
|
+
error: {
|
|
112
|
+
count: view.eventCounts.errorCount,
|
|
113
|
+
},
|
|
114
|
+
first_contentful_paint: toServerDuration(view.initialViewMetrics.firstContentfulPaint),
|
|
115
|
+
first_input_delay: toServerDuration(view.initialViewMetrics.firstInput?.delay),
|
|
116
|
+
first_input_time: toServerDuration(view.initialViewMetrics.firstInput?.time),
|
|
117
|
+
first_input_target_selector: view.initialViewMetrics.firstInput?.targetSelector,
|
|
118
|
+
interaction_to_next_paint: toServerDuration(view.commonViewMetrics.interactionToNextPaint?.value),
|
|
119
|
+
interaction_to_next_paint_time: toServerDuration(view.commonViewMetrics.interactionToNextPaint?.time),
|
|
120
|
+
interaction_to_next_paint_target_selector: view.commonViewMetrics.interactionToNextPaint?.targetSelector,
|
|
121
|
+
is_active: view.isActive,
|
|
122
|
+
name: view.name,
|
|
123
|
+
largest_contentful_paint: toServerDuration(view.initialViewMetrics.largestContentfulPaint?.value),
|
|
124
|
+
largest_contentful_paint_target_selector: view.initialViewMetrics.largestContentfulPaint?.targetSelector,
|
|
125
|
+
load_event: toServerDuration(view.initialViewMetrics.navigationTimings?.loadEvent),
|
|
126
|
+
loading_time: discardNegativeDuration(toServerDuration(view.commonViewMetrics.loadingTime)),
|
|
127
|
+
loading_type: view.loadingType,
|
|
128
|
+
long_task: {
|
|
129
|
+
count: view.eventCounts.longTaskCount,
|
|
130
|
+
},
|
|
131
|
+
performance: computeViewPerformanceData(view.commonViewMetrics, view.initialViewMetrics),
|
|
132
|
+
resource: {
|
|
133
|
+
count: view.eventCounts.resourceCount,
|
|
134
|
+
},
|
|
135
|
+
time_spent: toServerDuration(view.duration),
|
|
136
|
+
},
|
|
137
|
+
display: view.commonViewMetrics.scroll
|
|
138
|
+
? {
|
|
139
|
+
scroll: {
|
|
140
|
+
max_depth: view.commonViewMetrics.scroll.maxDepth,
|
|
141
|
+
max_depth_scroll_top: view.commonViewMetrics.scroll.maxDepthScrollTop,
|
|
142
|
+
max_scroll_height: view.commonViewMetrics.scroll.maxScrollHeight,
|
|
143
|
+
max_scroll_height_time: toServerDuration(view.commonViewMetrics.scroll.maxScrollHeightTime),
|
|
144
|
+
},
|
|
145
|
+
}
|
|
146
|
+
: undefined,
|
|
147
|
+
privacy: {
|
|
148
|
+
replay_level: configuration.defaultPrivacyLevel,
|
|
149
|
+
},
|
|
150
|
+
device: {
|
|
151
|
+
locale: navigator.language,
|
|
152
|
+
locales: navigator.languages,
|
|
153
|
+
time_zone: getTimeZone(),
|
|
154
|
+
},
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (!isEmptyObject(view.customTimings)) {
|
|
158
|
+
viewEvent.view.custom_timings = mapValues(
|
|
159
|
+
view.customTimings,
|
|
160
|
+
toServerDuration as (duration: Duration) => ServerDuration
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
rawRumEvent: viewEvent,
|
|
166
|
+
startTime: view.startClocks.relative,
|
|
167
|
+
duration: view.duration,
|
|
168
|
+
domainContext: {
|
|
169
|
+
location: view.location,
|
|
170
|
+
},
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function computeViewPerformanceData(
|
|
175
|
+
{ cumulativeLayoutShift, interactionToNextPaint }: CommonViewMetrics,
|
|
176
|
+
{ firstContentfulPaint, firstInput, largestContentfulPaint }: InitialViewMetrics
|
|
177
|
+
): ViewPerformanceData {
|
|
178
|
+
return {
|
|
179
|
+
cls: cumulativeLayoutShift && {
|
|
180
|
+
score: cumulativeLayoutShift.value,
|
|
181
|
+
timestamp: toServerDuration(cumulativeLayoutShift.time),
|
|
182
|
+
target_selector: cumulativeLayoutShift.targetSelector,
|
|
183
|
+
previous_rect: cumulativeLayoutShift.previousRect,
|
|
184
|
+
current_rect: cumulativeLayoutShift.currentRect,
|
|
185
|
+
},
|
|
186
|
+
fcp: firstContentfulPaint && { timestamp: toServerDuration(firstContentfulPaint) },
|
|
187
|
+
fid: firstInput && {
|
|
188
|
+
duration: toServerDuration(firstInput.delay),
|
|
189
|
+
timestamp: toServerDuration(firstInput.time),
|
|
190
|
+
target_selector: firstInput.targetSelector,
|
|
191
|
+
},
|
|
192
|
+
inp: interactionToNextPaint && {
|
|
193
|
+
duration: toServerDuration(interactionToNextPaint.value),
|
|
194
|
+
timestamp: toServerDuration(interactionToNextPaint.time),
|
|
195
|
+
target_selector: interactionToNextPaint.targetSelector,
|
|
196
|
+
},
|
|
197
|
+
lcp: largestContentfulPaint && {
|
|
198
|
+
timestamp: toServerDuration(largestContentfulPaint.value),
|
|
199
|
+
target_selector: largestContentfulPaint.targetSelector,
|
|
200
|
+
resource_url: largestContentfulPaint.resourceUrl,
|
|
201
|
+
},
|
|
202
|
+
}
|
|
203
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { RumLayoutShiftAttribution } from '../../../browser/performanceObservable'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Calculates the area of a rectangle given its width and height
|
|
5
|
+
*/
|
|
6
|
+
const calculateArea = (width: number, height: number): number => width * height
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Calculates the intersection area between two rectangles
|
|
10
|
+
*/
|
|
11
|
+
const calculateIntersectionArea = (rect1: DOMRectReadOnly, rect2: DOMRectReadOnly): number => {
|
|
12
|
+
const left = Math.max(rect1.left, rect2.left)
|
|
13
|
+
const top = Math.max(rect1.top, rect2.top)
|
|
14
|
+
const right = Math.min(rect1.right, rect2.right)
|
|
15
|
+
const bottom = Math.min(rect1.bottom, rect2.bottom)
|
|
16
|
+
|
|
17
|
+
if (left >= right || top >= bottom) {
|
|
18
|
+
return 0
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return calculateArea(right - left, bottom - top)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Calculates the total impacted area of a layout shift source
|
|
26
|
+
* This is the sum of the previous and current areas minus their intersection
|
|
27
|
+
*/
|
|
28
|
+
export const getClsAttributionImpactedArea = (source: RumLayoutShiftAttribution): number => {
|
|
29
|
+
const previousArea = calculateArea(source.previousRect.width, source.previousRect.height)
|
|
30
|
+
const currentArea = calculateArea(source.currentRect.width, source.currentRect.height)
|
|
31
|
+
const intersectionArea = calculateIntersectionArea(source.previousRect, source.currentRect)
|
|
32
|
+
|
|
33
|
+
return previousArea + currentArea - intersectionArea
|
|
34
|
+
}
|