@cloudcare/browser-rum 3.0.29 → 3.1.1
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/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +3 -2
- package/cjs/boot/buildEnv.js.map +1 -0
- package/cjs/boot/recorderApi.js +30 -46
- package/cjs/boot/recorderApi.js.map +1 -0
- package/cjs/boot/rum.entry.js +2 -7
- package/cjs/boot/rum.entry.js.map +1 -0
- package/cjs/boot/rum.js +40 -43
- package/cjs/boot/rum.js.map +1 -0
- package/cjs/boot/rumPublicApi.js +3 -49
- package/cjs/boot/rumPublicApi.js.map +1 -0
- package/cjs/boot/startRecording.js +7 -11
- package/cjs/boot/startRecording.js.map +1 -0
- package/cjs/constants.js +8 -6
- package/cjs/constants.js.map +1 -0
- package/cjs/domain/assembly.js +8 -20
- package/cjs/domain/assembly.js.map +1 -0
- package/cjs/domain/configuration.js +15 -52
- package/cjs/domain/configuration.js.map +1 -0
- package/cjs/domain/contexts/commonContext.js +2 -2
- package/cjs/domain/contexts/commonContext.js.map +1 -0
- package/cjs/domain/contexts/displayContext.js +28 -0
- package/cjs/domain/contexts/displayContext.js.map +1 -0
- package/cjs/domain/contexts/foregroundContexts.js +4 -29
- package/cjs/domain/contexts/foregroundContexts.js.map +1 -0
- package/cjs/domain/contexts/internalContext.js +5 -4
- package/cjs/domain/contexts/internalContext.js.map +1 -0
- package/cjs/domain/contexts/pageStateHistory.js +105 -0
- package/cjs/domain/contexts/pageStateHistory.js.map +1 -0
- package/cjs/domain/contexts/urlContexts.js +3 -9
- package/cjs/domain/contexts/urlContexts.js.map +1 -0
- package/cjs/domain/contexts/viewContexts.js +2 -6
- package/cjs/domain/contexts/viewContexts.js.map +1 -0
- package/cjs/domain/domMutationCollection.js +6 -10
- package/cjs/domain/domMutationCollection.js.map +1 -0
- package/cjs/domain/initViewportObservable.js +4 -11
- package/cjs/domain/initViewportObservable.js.map +1 -0
- package/cjs/domain/locationChangeObservable.js +2 -11
- package/cjs/domain/locationChangeObservable.js.map +1 -0
- package/cjs/domain/performanceCollection.js +11 -39
- package/cjs/domain/performanceCollection.js.map +1 -0
- package/cjs/domain/replay/deflate/deflateEncoder.js +82 -0
- package/cjs/domain/replay/deflate/deflateEncoder.js.map +1 -0
- package/cjs/domain/replay/deflate/deflateWorker.js +142 -0
- package/cjs/domain/replay/deflate/deflateWorker.js.map +1 -0
- package/cjs/domain/replay/deflate/index.js +44 -0
- package/cjs/domain/replay/deflate/index.js.map +1 -0
- package/cjs/domain/replay/record/elementsScrollPositions.js +2 -3
- package/cjs/domain/replay/record/elementsScrollPositions.js.map +1 -0
- package/cjs/domain/replay/record/index.js +2 -4
- package/cjs/domain/replay/record/index.js.map +1 -0
- package/cjs/domain/replay/record/mutationBatch.js +4 -11
- package/cjs/domain/replay/record/mutationBatch.js.map +1 -0
- package/cjs/domain/replay/record/mutationObserver.js +27 -86
- package/cjs/domain/replay/record/mutationObserver.js.map +1 -0
- package/cjs/domain/replay/record/observers.js +15 -89
- package/cjs/domain/replay/record/observers.js.map +1 -0
- package/cjs/domain/replay/record/privacy.js +57 -75
- package/cjs/domain/replay/record/privacy.js.map +1 -0
- package/cjs/domain/replay/record/record.js +6 -29
- package/cjs/domain/replay/record/record.js.map +1 -0
- package/cjs/domain/replay/record/serializationUtils.js +8 -68
- package/cjs/domain/replay/record/serializationUtils.js.map +1 -0
- package/cjs/domain/replay/record/serialize.js +43 -118
- package/cjs/domain/replay/record/serialize.js.map +1 -0
- package/cjs/domain/replay/record/shadowRootsController.js +4 -11
- package/cjs/domain/replay/record/shadowRootsController.js.map +1 -0
- package/cjs/domain/replay/record/utils.js +4 -12
- package/cjs/domain/replay/record/utils.js.map +1 -0
- package/cjs/domain/replay/record/viewports.js +4 -42
- package/cjs/domain/replay/record/viewports.js.map +1 -0
- package/cjs/domain/replay/replayStats.js +2 -14
- package/cjs/domain/replay/replayStats.js.map +1 -0
- package/cjs/domain/replay/segmentCollection/buildReplayPayload.js +4 -9
- package/cjs/domain/replay/segmentCollection/buildReplayPayload.js.map +1 -0
- package/cjs/domain/replay/segmentCollection/index.js +1 -9
- package/cjs/domain/replay/segmentCollection/index.js.map +1 -0
- package/cjs/domain/replay/segmentCollection/segment.js +23 -87
- package/cjs/domain/replay/segmentCollection/segment.js.map +1 -0
- package/cjs/domain/replay/segmentCollection/segmentCollection.js +41 -64
- package/cjs/domain/replay/segmentCollection/segmentCollection.js.map +1 -0
- package/cjs/domain/requestCollection.js +2 -17
- package/cjs/domain/requestCollection.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/actionCollection.js +12 -22
- package/cjs/domain/rumEventsCollection/actions/actionCollection.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/clickChain.js +3 -14
- package/cjs/domain/rumEventsCollection/actions/clickChain.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/computeFrustration.js +12 -20
- package/cjs/domain/rumEventsCollection/actions/computeFrustration.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js +22 -53
- package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/getSelectorsFromElement.js +13 -45
- package/cjs/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js +4 -6
- package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js +15 -45
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -0
- package/cjs/domain/rumEventsCollection/error/errorCollection.js +13 -23
- package/cjs/domain/rumEventsCollection/error/errorCollection.js.map +1 -0
- package/cjs/domain/rumEventsCollection/error/trackConsoleError.js +2 -3
- package/cjs/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -0
- package/cjs/domain/rumEventsCollection/error/trackReportError.js +4 -5
- package/cjs/domain/rumEventsCollection/error/trackReportError.js.map +1 -0
- package/cjs/domain/rumEventsCollection/longTask/longTaskCollection.js +2 -7
- package/cjs/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -0
- package/cjs/domain/rumEventsCollection/resource/matchRequestTiming.js +2 -13
- package/cjs/domain/rumEventsCollection/resource/matchRequestTiming.js.map +1 -0
- package/cjs/domain/rumEventsCollection/resource/resourceCollection.js +2 -18
- package/cjs/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -0
- package/cjs/domain/rumEventsCollection/resource/resourceUtils.js +58 -69
- package/cjs/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/interactionCountPolyfill.js +55 -0
- package/cjs/domain/rumEventsCollection/view/interactionCountPolyfill.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js +62 -0
- package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +74 -0
- package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +26 -0
- package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackFirstHidden.js +2 -8
- package/cjs/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackFirstInputTimings.js +38 -0
- package/cjs/domain/rumEventsCollection/view/trackFirstInputTimings.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js +26 -179
- package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +120 -0
- package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +49 -0
- package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackLoadingTime.js +39 -0
- package/cjs/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js +37 -0
- package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackScrollMetrics.js +61 -0
- package/cjs/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackViewEventCounts.js +3 -6
- package/cjs/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackViews.js +26 -58
- package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/viewCollection.js +43 -48
- package/cjs/domain/rumEventsCollection/view/viewCollection.js.map +1 -0
- package/cjs/domain/rumSessionManager.js +3 -13
- package/cjs/domain/rumSessionManager.js.map +1 -0
- package/cjs/domain/tracing/ddtraceTracer.js +2 -4
- package/cjs/domain/tracing/ddtraceTracer.js.map +1 -0
- package/cjs/domain/tracing/getDocumentTraceId.js +5 -22
- package/cjs/domain/tracing/getDocumentTraceId.js.map +1 -0
- package/cjs/domain/tracing/jaegerTracer.js +2 -4
- package/cjs/domain/tracing/jaegerTracer.js.map +1 -0
- package/cjs/domain/tracing/skywalkingTracer.js +6 -13
- package/cjs/domain/tracing/skywalkingTracer.js.map +1 -0
- package/cjs/domain/tracing/traceIdentifier.js +2 -7
- package/cjs/domain/tracing/traceIdentifier.js.map +1 -0
- package/cjs/domain/tracing/tracer.js +5 -30
- package/cjs/domain/tracing/tracer.js.map +1 -0
- package/cjs/domain/tracing/w3cTraceParentTracer.js +2 -11
- package/cjs/domain/tracing/w3cTraceParentTracer.js.map +1 -0
- package/cjs/domain/tracing/zipkinMultiTracer.js +4 -6
- package/cjs/domain/tracing/zipkinMultiTracer.js.map +1 -0
- package/cjs/domain/tracing/zipkinSingleTracer.js +2 -4
- package/cjs/domain/tracing/zipkinSingleTracer.js.map +1 -0
- package/cjs/domain/trackEventCounts.js +2 -10
- package/cjs/domain/trackEventCounts.js.map +1 -0
- package/cjs/domain/usr/index.js +2 -7
- package/cjs/domain/usr/index.js.map +1 -0
- package/cjs/domain/waitPageActivityEnd.js +7 -23
- package/cjs/domain/waitPageActivityEnd.js.map +1 -0
- package/cjs/index.js +2 -2
- package/cjs/index.js.map +1 -0
- package/cjs/transport/startRumBatch.js +7 -8
- package/cjs/transport/startRumBatch.js.map +1 -0
- package/cjs/transport/startRumEventBridge.js +2 -3
- package/cjs/transport/startRumEventBridge.js.map +1 -0
- package/cjs/types/index.js +2 -3
- package/cjs/types/index.js.map +1 -0
- package/cjs/types/sessionReplayConstants.js +4 -3
- package/cjs/types/sessionReplayConstants.js.map +1 -0
- package/esm/boot/buildEnv.js +3 -2
- package/esm/boot/buildEnv.js.map +1 -0
- package/esm/boot/recorderApi.js +32 -42
- package/esm/boot/recorderApi.js.map +1 -0
- package/esm/boot/rum.entry.js +2 -1
- package/esm/boot/rum.entry.js.map +1 -0
- package/esm/boot/rum.js +41 -23
- package/esm/boot/rum.js.map +1 -0
- package/esm/boot/rumPublicApi.js +3 -43
- package/esm/boot/rumPublicApi.js.map +1 -0
- package/esm/boot/startRecording.js +8 -7
- package/esm/boot/startRecording.js.map +1 -0
- package/esm/constants.js +8 -4
- package/esm/constants.js.map +1 -0
- package/esm/domain/assembly.js +8 -17
- package/esm/domain/assembly.js.map +1 -0
- package/esm/domain/configuration.js +15 -38
- package/esm/domain/configuration.js.map +1 -0
- package/esm/domain/contexts/commonContext.js +2 -1
- package/esm/domain/contexts/commonContext.js.map +1 -0
- package/esm/domain/contexts/displayContext.js +21 -0
- package/esm/domain/contexts/displayContext.js.map +1 -0
- package/esm/domain/contexts/foregroundContexts.js +6 -25
- package/esm/domain/contexts/foregroundContexts.js.map +1 -0
- package/esm/domain/contexts/internalContext.js +5 -3
- package/esm/domain/contexts/internalContext.js.map +1 -0
- package/esm/domain/contexts/pageStateHistory.js +95 -0
- package/esm/domain/contexts/pageStateHistory.js.map +1 -0
- package/esm/domain/contexts/urlContexts.js +3 -6
- package/esm/domain/contexts/urlContexts.js.map +1 -0
- package/esm/domain/contexts/viewContexts.js +2 -3
- package/esm/domain/contexts/viewContexts.js.map +1 -0
- package/esm/domain/domMutationCollection.js +6 -7
- package/esm/domain/domMutationCollection.js.map +1 -0
- package/esm/domain/initViewportObservable.js +4 -6
- package/esm/domain/initViewportObservable.js.map +1 -0
- package/esm/domain/locationChangeObservable.js +2 -9
- package/esm/domain/locationChangeObservable.js.map +1 -0
- package/esm/domain/performanceCollection.js +11 -35
- package/esm/domain/performanceCollection.js.map +1 -0
- package/esm/domain/replay/deflate/deflateEncoder.js +74 -0
- package/esm/domain/replay/deflate/deflateEncoder.js.map +1 -0
- package/esm/domain/replay/deflate/deflateWorker.js +129 -0
- package/esm/domain/replay/deflate/deflateWorker.js.map +1 -0
- package/esm/domain/replay/deflate/index.js +3 -0
- package/esm/domain/replay/deflate/index.js.map +1 -0
- package/esm/domain/replay/record/elementsScrollPositions.js +2 -2
- package/esm/domain/replay/record/elementsScrollPositions.js.map +1 -0
- package/esm/domain/replay/record/index.js +2 -1
- package/esm/domain/replay/record/index.js.map +1 -0
- package/esm/domain/replay/record/mutationBatch.js +5 -9
- package/esm/domain/replay/record/mutationBatch.js.map +1 -0
- package/esm/domain/replay/record/mutationObserver.js +29 -80
- package/esm/domain/replay/record/mutationObserver.js.map +1 -0
- package/esm/domain/replay/record/observers.js +15 -72
- package/esm/domain/replay/record/observers.js.map +1 -0
- package/esm/domain/replay/record/privacy.js +57 -65
- package/esm/domain/replay/record/privacy.js.map +1 -0
- package/esm/domain/replay/record/record.js +6 -19
- package/esm/domain/replay/record/record.js.map +1 -0
- package/esm/domain/replay/record/serializationUtils.js +8 -46
- package/esm/domain/replay/record/serializationUtils.js.map +1 -0
- package/esm/domain/replay/record/serialize.js +45 -107
- package/esm/domain/replay/record/serialize.js.map +1 -0
- package/esm/domain/replay/record/shadowRootsController.js +4 -6
- package/esm/domain/replay/record/shadowRootsController.js.map +1 -0
- package/esm/domain/replay/record/utils.js +4 -6
- package/esm/domain/replay/record/utils.js.map +1 -0
- package/esm/domain/replay/record/viewports.js +3 -32
- package/esm/domain/replay/record/viewports.js.map +1 -0
- package/esm/domain/replay/replayStats.js +2 -8
- package/esm/domain/replay/replayStats.js.map +1 -0
- package/esm/domain/replay/segmentCollection/buildReplayPayload.js +4 -6
- package/esm/domain/replay/segmentCollection/buildReplayPayload.js.map +1 -0
- package/esm/domain/replay/segmentCollection/index.js +2 -2
- package/esm/domain/replay/segmentCollection/index.js.map +1 -0
- package/esm/domain/replay/segmentCollection/segment.js +21 -77
- package/esm/domain/replay/segmentCollection/segment.js.map +1 -0
- package/esm/domain/replay/segmentCollection/segmentCollection.js +40 -53
- package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -0
- package/esm/domain/requestCollection.js +2 -10
- package/esm/domain/requestCollection.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/actionCollection.js +12 -19
- package/esm/domain/rumEventsCollection/actions/actionCollection.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/clickChain.js +3 -10
- package/esm/domain/rumEventsCollection/actions/clickChain.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/computeFrustration.js +12 -14
- package/esm/domain/rumEventsCollection/actions/computeFrustration.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js +22 -50
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js +12 -40
- package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/listenActionEvents.js +4 -4
- package/esm/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js +18 -37
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -0
- package/esm/domain/rumEventsCollection/error/errorCollection.js +14 -19
- package/esm/domain/rumEventsCollection/error/errorCollection.js.map +1 -0
- package/esm/domain/rumEventsCollection/error/trackConsoleError.js +2 -1
- package/esm/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -0
- package/esm/domain/rumEventsCollection/error/trackReportError.js +4 -3
- package/esm/domain/rumEventsCollection/error/trackReportError.js.map +1 -0
- package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js +2 -5
- package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -0
- package/esm/domain/rumEventsCollection/resource/matchRequestTiming.js +3 -11
- package/esm/domain/rumEventsCollection/resource/matchRequestTiming.js.map +1 -0
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js +2 -13
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -0
- package/esm/domain/rumEventsCollection/resource/resourceUtils.js +58 -57
- package/esm/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/interactionCountPolyfill.js +47 -0
- package/esm/domain/rumEventsCollection/view/interactionCountPolyfill.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js +56 -0
- package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +67 -0
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +18 -0
- package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackFirstHidden.js +2 -4
- package/esm/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackFirstInputTimings.js +32 -0
- package/esm/domain/rumEventsCollection/view/trackFirstInputTimings.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js +25 -164
- package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +113 -0
- package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +41 -0
- package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackLoadingTime.js +33 -0
- package/esm/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js +31 -0
- package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js +53 -0
- package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js +5 -3
- package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackViews.js +28 -54
- package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/viewCollection.js +43 -44
- package/esm/domain/rumEventsCollection/view/viewCollection.js.map +1 -0
- package/esm/domain/rumSessionManager.js +3 -9
- package/esm/domain/rumSessionManager.js.map +1 -0
- package/esm/domain/tracing/ddtraceTracer.js +2 -2
- package/esm/domain/tracing/ddtraceTracer.js.map +1 -0
- package/esm/domain/tracing/getDocumentTraceId.js +5 -15
- package/esm/domain/tracing/getDocumentTraceId.js.map +1 -0
- package/esm/domain/tracing/jaegerTracer.js +3 -2
- package/esm/domain/tracing/jaegerTracer.js.map +1 -0
- package/esm/domain/tracing/skywalkingTracer.js +8 -12
- package/esm/domain/tracing/skywalkingTracer.js.map +1 -0
- package/esm/domain/tracing/traceIdentifier.js +2 -4
- package/esm/domain/tracing/traceIdentifier.js.map +1 -0
- package/esm/domain/tracing/tracer.js +5 -19
- package/esm/domain/tracing/tracer.js.map +1 -0
- package/esm/domain/tracing/w3cTraceParentTracer.js +4 -8
- package/esm/domain/tracing/w3cTraceParentTracer.js.map +1 -0
- package/esm/domain/tracing/zipkinMultiTracer.js +5 -4
- package/esm/domain/tracing/zipkinMultiTracer.js.map +1 -0
- package/esm/domain/tracing/zipkinSingleTracer.js +3 -2
- package/esm/domain/tracing/zipkinSingleTracer.js.map +1 -0
- package/esm/domain/trackEventCounts.js +2 -8
- package/esm/domain/trackEventCounts.js.map +1 -0
- package/esm/domain/usr/index.js +2 -3
- package/esm/domain/usr/index.js.map +1 -0
- package/esm/domain/waitPageActivityEnd.js +9 -19
- package/esm/domain/waitPageActivityEnd.js.map +1 -0
- package/esm/index.js +2 -1
- package/esm/index.js.map +1 -0
- package/esm/transport/startRumBatch.js +7 -6
- package/esm/transport/startRumBatch.js.map +1 -0
- package/esm/transport/startRumEventBridge.js +2 -1
- package/esm/transport/startRumEventBridge.js.map +1 -0
- package/esm/types/index.js.map +1 -0
- package/esm/types/sessionReplayConstants.js +5 -3
- package/esm/types/sessionReplayConstants.js.map +1 -0
- package/package.json +6 -5
- package/src/boot/recorderApi.js +43 -32
- package/src/boot/rum.js +45 -10
- package/src/boot/startRecording.js +7 -3
- package/src/domain/assembly.js +5 -2
- package/src/domain/configuration.js +0 -1
- package/src/domain/contexts/displayContext.js +29 -0
- package/src/domain/contexts/internalContext.js +3 -1
- package/src/domain/contexts/pageStateHistory.js +138 -0
- package/src/domain/replay/deflate/deflateEncoder.js +88 -0
- package/src/domain/replay/{segmentCollection/startDeflateWorker.js → deflate/deflateWorker.js} +55 -32
- package/src/domain/replay/deflate/index.js +7 -0
- package/src/domain/replay/record/mutationObserver.js +2 -1
- package/src/domain/replay/record/observers.js +3 -3
- package/src/domain/replay/record/privacy.js +20 -23
- package/src/domain/replay/record/record.js +2 -2
- package/src/domain/replay/record/serializationUtils.js +4 -2
- package/src/domain/replay/record/serialize.js +11 -14
- package/src/domain/replay/record/shadowRootsController.js +0 -1
- package/src/domain/replay/record/viewports.js +0 -26
- package/src/domain/replay/segmentCollection/buildReplayPayload.js +1 -1
- package/src/domain/replay/segmentCollection/index.js +0 -1
- package/src/domain/replay/segmentCollection/segment.js +28 -83
- package/src/domain/replay/segmentCollection/segmentCollection.js +49 -55
- package/src/domain/rumEventsCollection/actions/actionCollection.js +12 -12
- package/src/domain/rumEventsCollection/actions/trackClickActions.js +8 -6
- package/src/domain/rumEventsCollection/error/errorCollection.js +20 -15
- package/src/domain/rumEventsCollection/error/trackReportError.js +22 -16
- package/src/domain/rumEventsCollection/view/interactionCountPolyfill.js +59 -0
- package/src/domain/rumEventsCollection/view/trackCommonViewMetrics.js +87 -0
- package/src/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +73 -0
- package/src/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +23 -0
- package/src/domain/rumEventsCollection/view/trackFirstInputTimings.js +40 -0
- package/src/domain/rumEventsCollection/view/trackInitialViewTimings.js +29 -199
- package/src/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +144 -0
- package/src/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +57 -0
- package/src/domain/rumEventsCollection/view/trackLoadingTime.js +50 -0
- package/src/domain/rumEventsCollection/view/trackNavigationTimings.js +35 -0
- package/src/domain/rumEventsCollection/view/trackScrollMetrics.js +74 -0
- package/src/domain/rumEventsCollection/view/trackViews.js +32 -37
- package/src/domain/rumEventsCollection/view/viewCollection.js +51 -22
- package/src/transport/startRumBatch.js +5 -1
- package/cjs/domain/replay/segmentCollection/startDeflateWorker.js +0 -145
- package/cjs/domain/rumEventsCollection/view/trackViewMetrics.js +0 -156
- package/esm/domain/replay/segmentCollection/startDeflateWorker.js +0 -128
- package/esm/domain/rumEventsCollection/view/trackViewMetrics.js +0 -146
- package/src/domain/rumEventsCollection/view/trackViewMetrics.js +0 -176
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
* which viewport is being measured. Therefore these exported functions will fallback to assuming that the layout
|
|
9
9
|
* viewport is being measured by the browser
|
|
10
10
|
*/
|
|
11
|
+
|
|
11
12
|
// Scrollbar widths vary across properties on different devices and browsers
|
|
12
13
|
var TOLERANCE = 25;
|
|
14
|
+
|
|
13
15
|
/**
|
|
14
16
|
* Use the Visual Viewport API's properties to measure scrollX/Y in reference to the layout viewport
|
|
15
17
|
* in order to determine if window.scrollX/Y is measuring the layout or visual viewport.
|
|
16
18
|
* This finding corresponds to which viewport mouseEvent.clientX/Y and window.innerWidth/Height measures.
|
|
17
19
|
*/
|
|
18
|
-
|
|
19
20
|
function isVisualViewportFactoredIn() {
|
|
20
21
|
var visual = window.visualViewport;
|
|
21
22
|
return Math.abs(visual.pageTop - visual.offsetTop - window.scrollY) > TOLERANCE || Math.abs(visual.pageLeft - visual.offsetLeft - window.scrollX) > TOLERANCE;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
24
|
export var convertMouseEventToLayoutCoordinates = function convertMouseEventToLayoutCoordinates(clientX, clientY) {
|
|
25
25
|
var visual = window.visualViewport;
|
|
26
26
|
var normalised = {
|
|
@@ -29,7 +29,6 @@ export var convertMouseEventToLayoutCoordinates = function convertMouseEventToLa
|
|
|
29
29
|
visualViewportX: clientX,
|
|
30
30
|
visualViewportY: clientY
|
|
31
31
|
};
|
|
32
|
-
|
|
33
32
|
if (!visual) {
|
|
34
33
|
// On old browsers, we cannot normalise, so fallback to clientX/Y
|
|
35
34
|
return normalised;
|
|
@@ -42,7 +41,6 @@ export var convertMouseEventToLayoutCoordinates = function convertMouseEventToLa
|
|
|
42
41
|
normalised.visualViewportX = Math.round(clientX - visual.offsetLeft);
|
|
43
42
|
normalised.visualViewportY = Math.round(clientY - visual.offsetTop);
|
|
44
43
|
}
|
|
45
|
-
|
|
46
44
|
return normalised;
|
|
47
45
|
};
|
|
48
46
|
export var getVisualViewport = function getVisualViewport() {
|
|
@@ -57,31 +55,4 @@ export var getVisualViewport = function getVisualViewport() {
|
|
|
57
55
|
width: visual.width
|
|
58
56
|
};
|
|
59
57
|
};
|
|
60
|
-
|
|
61
|
-
var scrollX;
|
|
62
|
-
var visual = window.visualViewport;
|
|
63
|
-
|
|
64
|
-
if (visual) {
|
|
65
|
-
scrollX = visual.pageLeft - visual.offsetLeft;
|
|
66
|
-
} else if (window.scrollX !== undefined) {
|
|
67
|
-
scrollX = window.scrollX;
|
|
68
|
-
} else {
|
|
69
|
-
scrollX = window.pageXOffset || 0;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return Math.round(scrollX);
|
|
73
|
-
}
|
|
74
|
-
export function getScrollY() {
|
|
75
|
-
var scrollY;
|
|
76
|
-
var visual = window.visualViewport;
|
|
77
|
-
|
|
78
|
-
if (visual) {
|
|
79
|
-
scrollY = visual.pageTop - visual.offsetTop;
|
|
80
|
-
} else if (window.scrollY !== undefined) {
|
|
81
|
-
scrollY = window.scrollY;
|
|
82
|
-
} else {
|
|
83
|
-
scrollY = window.pageYOffset || 0;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return Math.round(scrollY);
|
|
87
|
-
}
|
|
58
|
+
//# sourceMappingURL=viewports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewports.js","names":["TOLERANCE","isVisualViewportFactoredIn","visual","window","visualViewport","Math","abs","pageTop","offsetTop","scrollY","pageLeft","offsetLeft","scrollX","convertMouseEventToLayoutCoordinates","clientX","clientY","normalised","layoutViewportX","layoutViewportY","visualViewportX","visualViewportY","round","getVisualViewport","scale","height","width"],"sources":["../../../../src/domain/replay/record/viewports.js"],"sourcesContent":["/**\n * Browsers have not standardized various dimension properties. Mobile devices typically report\n * dimensions in reference to the visual viewport, while desktop uses the layout viewport. For example,\n * Mobile Chrome will change innerWidth when a pinch zoom takes place, while Chrome Desktop (mac) will not.\n *\n * With the new Viewport API, we now calculate and normalize dimension properties to the layout viewport.\n * If the VisualViewport API is not supported by a browser, it isn't reasonably possible to detect or normalize\n * which viewport is being measured. Therefore these exported functions will fallback to assuming that the layout\n * viewport is being measured by the browser\n */\n\n// Scrollbar widths vary across properties on different devices and browsers\nvar TOLERANCE = 25\n\n/**\n * Use the Visual Viewport API's properties to measure scrollX/Y in reference to the layout viewport\n * in order to determine if window.scrollX/Y is measuring the layout or visual viewport.\n * This finding corresponds to which viewport mouseEvent.clientX/Y and window.innerWidth/Height measures.\n */\nfunction isVisualViewportFactoredIn() {\n var visual = window.visualViewport\n return (\n Math.abs(visual.pageTop - visual.offsetTop - window.scrollY) > TOLERANCE ||\n Math.abs(visual.pageLeft - visual.offsetLeft - window.scrollX) > TOLERANCE\n )\n}\n\nexport var convertMouseEventToLayoutCoordinates = function (clientX, clientY) {\n var visual = window.visualViewport\n var normalised = {\n layoutViewportX: clientX,\n layoutViewportY: clientY,\n visualViewportX: clientX,\n visualViewportY: clientY\n }\n\n if (!visual) {\n // On old browsers, we cannot normalise, so fallback to clientX/Y\n return normalised\n } else if (isVisualViewportFactoredIn()) {\n // Typically Mobile Devices\n normalised.layoutViewportX = Math.round(clientX + visual.offsetLeft)\n normalised.layoutViewportY = Math.round(clientY + visual.offsetTop)\n } else {\n // Typically Desktop Devices\n normalised.visualViewportX = Math.round(clientX - visual.offsetLeft)\n normalised.visualViewportY = Math.round(clientY - visual.offsetTop)\n }\n return normalised\n}\n\nexport var getVisualViewport = function () {\n var visual = window.visualViewport\n return {\n scale: visual.scale,\n offsetLeft: visual.offsetLeft,\n offsetTop: visual.offsetTop,\n pageLeft: visual.pageLeft,\n pageTop: visual.pageTop,\n height: visual.height,\n width: visual.width\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAIA,SAAS,GAAG,EAAE;;AAElB;AACA;AACA;AACA;AACA;AACA,SAASC,0BAA0BA,CAAA,EAAG;EACpC,IAAIC,MAAM,GAAGC,MAAM,CAACC,cAAc;EAClC,OACEC,IAAI,CAACC,GAA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CAACS,UAAU;IAC7BH,SAAS,EAAEN,MAAM,CAACM,SAAS;IAC3BE,QAAQ,EAAER,MAAM,CAACQ,QAAQ;IACzBH,OAAO,EAAEL,MAAM,CAACK,OAAO;IACvBiB,MAAM,EAAEtB,MAAM,CAACsB,MAAM;IACrBC,KAAK,EAAEvB,MAAM,CAACuB;EAChB,CAAC;AACH,CAAC"}
|
|
@@ -18,14 +18,11 @@ export function getReplayStats(viewId) {
|
|
|
18
18
|
export function resetReplayStats() {
|
|
19
19
|
statsPerView = undefined;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
21
|
function getOrCreateReplayStats(viewId) {
|
|
23
22
|
if (!statsPerView) {
|
|
24
23
|
statsPerView = new Map();
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
var replayStats;
|
|
28
|
-
|
|
29
26
|
if (statsPerView.has(viewId)) {
|
|
30
27
|
replayStats = statsPerView.get(viewId);
|
|
31
28
|
} else {
|
|
@@ -35,20 +32,16 @@ function getOrCreateReplayStats(viewId) {
|
|
|
35
32
|
segments_total_raw_size: 0
|
|
36
33
|
};
|
|
37
34
|
statsPerView.set(viewId, replayStats);
|
|
38
|
-
|
|
39
35
|
if (statsPerView.size > MAX_STATS_HISTORY) {
|
|
40
36
|
deleteOldestStats();
|
|
41
37
|
}
|
|
42
38
|
}
|
|
43
|
-
|
|
44
39
|
return replayStats;
|
|
45
40
|
}
|
|
46
|
-
|
|
47
41
|
function deleteOldestStats() {
|
|
48
42
|
if (!statsPerView) {
|
|
49
43
|
return;
|
|
50
44
|
}
|
|
51
|
-
|
|
52
45
|
if (statsPerView.keys) {
|
|
53
46
|
statsPerView["delete"](statsPerView.keys().next().value);
|
|
54
47
|
} else {
|
|
@@ -61,4 +54,5 @@ function deleteOldestStats() {
|
|
|
61
54
|
}
|
|
62
55
|
});
|
|
63
56
|
}
|
|
64
|
-
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=replayStats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replayStats.js","names":["MAX_STATS_HISTORY","statsPerView","getSegmentsCount","viewId","getOrCreateReplayStats","segments_count","addSegment","addRecord","records_count","addWroteData","additionalBytesCount","segments_total_raw_size","getReplayStats","get","resetReplayStats","undefined","Map","replayStats","has","set","size","deleteOldestStats","keys","next","value","isFirst","forEach","_value","key"],"sources":["../../../src/domain/replay/replayStats.js"],"sourcesContent":["export var MAX_STATS_HISTORY = 10\nvar statsPerView\n\nexport function getSegmentsCount(viewId) {\n return getOrCreateReplayStats(viewId).segments_count\n}\n\nexport function addSegment(viewId) {\n getOrCreateReplayStats(viewId).segments_count += 1\n}\n\nexport function addRecord(viewId) {\n getOrCreateReplayStats(viewId).records_count += 1\n}\n\nexport function addWroteData(viewId, additionalBytesCount) {\n getOrCreateReplayStats(viewId).segments_total_raw_size += additionalBytesCount\n}\n\nexport function getReplayStats(viewId) {\n return statsPerView && statsPerView.get(viewId)\n}\n\nexport function resetReplayStats() {\n statsPerView = undefined\n}\n\nfunction getOrCreateReplayStats(viewId) {\n if (!statsPerView) {\n statsPerView = new Map()\n }\n\n var replayStats\n if (statsPerView.has(viewId)) {\n replayStats = statsPerView.get(viewId)\n } else {\n replayStats = {\n records_count: 0,\n segments_count: 0,\n segments_total_raw_size: 0\n }\n statsPerView.set(viewId, replayStats)\n if (statsPerView.size > MAX_STATS_HISTORY) {\n deleteOldestStats()\n }\n }\n\n return replayStats\n}\n\nfunction deleteOldestStats() {\n if (!statsPerView) {\n return\n }\n if (statsPerView.keys) {\n statsPerView.delete(statsPerView.keys().next().value)\n } else {\n // IE11 doesn't support map.keys\n var isFirst = true\n statsPerView.forEach(function (_value, key) {\n if (isFirst) {\n statsPerView.delete(key)\n isFirst = false\n }\n })\n }\n}\n"],"mappings":"AAAA,OAAO,IAAIA,iBAAiB,GAAG,EAAE;AACjC,IAAIC,YAAY;AAEhB,OAAO,SAASC,gBAAgBA,CAACC,MAAM,EAAE;EACvC,OAAOC,sBAAsB,CAAC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;IACrBrB,YAAY,UAAO,CAACA,YAAY,CAACqB,IAAI,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC;EACvD,CAAC,MAAM;IACL;IACA,IAAIC,OAAO,GAAG,IAAI;IAClBxB,YAAY,CAACyB,OAAO,CAAC,UAAUC,MAAM,EAAEC,GAAG,EAAE;MAC1C,IAAIH,OAAO,EAAE;QACXxB,YAAY,UAAO,CAAC2B,GAAG,CAAC;QACxBH,OAAO,GAAG,KAAK;MACjB;IACF,CAAC,CAAC;EACJ;AACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
2
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
2
|
import { objectEntries, each } from '@cloudcare/browser-core';
|
|
4
3
|
export function buildReplayPayload(data, metadata, rawSegmentBytesCount) {
|
|
5
4
|
var formData = new FormData();
|
|
@@ -9,7 +8,7 @@ export function buildReplayPayload(data, metadata, rawSegmentBytesCount) {
|
|
|
9
8
|
toFormEntries(metadata, function (key, value) {
|
|
10
9
|
formData.append(key, value);
|
|
11
10
|
});
|
|
12
|
-
formData.append('raw_segment_size', rawSegmentBytesCount
|
|
11
|
+
formData.append('raw_segment_size', rawSegmentBytesCount);
|
|
13
12
|
return {
|
|
14
13
|
data: formData,
|
|
15
14
|
bytesCount: data.byteLength
|
|
@@ -19,15 +18,14 @@ export function toFormEntries(input, onEntry, prefix) {
|
|
|
19
18
|
if (prefix === undefined) {
|
|
20
19
|
prefix = '';
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
each(objectEntries(input), function (item) {
|
|
24
22
|
var value = item[1];
|
|
25
23
|
var key = item[0];
|
|
26
|
-
|
|
27
24
|
if (_typeof(value) === 'object' && value !== null) {
|
|
28
25
|
toFormEntries(value, onEntry, '' + prefix + key + '_');
|
|
29
26
|
} else {
|
|
30
27
|
onEntry('' + prefix + key, String(value));
|
|
31
28
|
}
|
|
32
29
|
});
|
|
33
|
-
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=buildReplayPayload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildReplayPayload.js","names":["objectEntries","each","buildReplayPayload","data","metadata","rawSegmentBytesCount","formData","FormData","append","Blob","type","session","id","start","toFormEntries","key","value","bytesCount","byteLength","input","onEntry","prefix","undefined","item","_typeof","String"],"sources":["../../../../src/domain/replay/segmentCollection/buildReplayPayload.js"],"sourcesContent":["import { objectEntries, each } from '@cloudcare/browser-core'\n\nexport function buildReplayPayload(data, metadata, rawSegmentBytesCount) {\n var formData = new FormData()\n formData.append(\n 'segment',\n new Blob([data], {\n type: 'application/octet-stream'\n }),\n metadata.session.id + '-' + metadata.start\n )\n\n toFormEntries(metadata, function (key, value) {\n formData.append(key, value)\n })\n formData.append('raw_segment_size', rawSegmentBytesCount)\n\n return { data: formData, bytesCount: data.byteLength }\n}\n\nexport function toFormEntries(input, onEntry, prefix) {\n if (prefix === undefined) {\n prefix = ''\n }\n each(objectEntries(input), function (item) {\n var value = item[1]\n var key = item[0]\n if (typeof value === 'object' && value !== null) {\n toFormEntries(value, onEntry, '' + prefix + key + '_')\n } else {\n onEntry('' + prefix + key, String(value))\n }\n })\n}\n"],"mappings":";AAAA,SAASA,aAAa,EAAEC,IAAI,QAAQ,yBAAyB;AAE7D,OAAO,SAASC,kBAAkBA,CAACC,IAAI,EAAEC,QAAQ,EAAEC,oBAAoB,EAAE;EACvE,IAAIC,QAAQ,GAAG,IAAIC,QAAQ,CAAC,CAAC;EAC7BD,QAAQ,CAACE,MAAM,CACb,SAAS,EACT,IAAIC,IAAI,CAAC,CAACN,IAAI,CAAC,EAAE;IACfO,IAAI,EAAE;EACR,CAAC,CAAC,EACFN,QAAQ,CAACO,OAAO,CAACC,EAAE,GAAG,GAAG,GAAGR,QAAQ,CAACS,KACvC,CAAC;EAEDC,aAAa,CAACV,QAAQ,EAAE,UAAUW,GAAG,EAAEC,KAAK,EAAE;IAC5CV,QAAQ,CAACE,MAAM,CAACO,GAAG,EAAEC,KAAK,CAAC;EAC7B,CAAC,CAAC;EACFV,QAAQ,CAACE,MAAM,CAAC,kBAAkB,EAAEH,oBAAoB,CAAC;EAEzD,OAAO;IAAEF,IAAI,EAAEG,QAAQ;IAAEW,UAAU,EAAEd,IAAI,CAACe;EAAW,CAAC;AACxD;AAEA,OAAO,SAASJ,aAAaA,CAACK,KAAK,EAAEC,OAAO,EAAEC,MAAM,EAAE;EACpD,IAAIA,MAAM,KAAKC,SAAS,EAAE;IACxBD,MAAM,GAAG,EAAE;EACb;EACApB,IAAI,CAACD,aAAa,CAACmB,KAAK,CAAC,EAAE,UAAUI,IAAI,EAAE;IACzC,IAAIP,KAAK,GAAGO,IAAI,CAAC,CAAC,CAAC;IACnB,IAAIR,GAAG,GAAGQ,IAAI,CAAC,CAAC,CAAC;IACjB,IAAIC,OAAA,CAAOR,KAAK,MAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,EAAE;MAC/CF,aAAa,CAACE,KAAK,EAAEI,OAAO,EAAE,EAAE,GAAGC,MAAM,GAAGN,GAAG,GAAG,GAAG,CAAC;IACxD,CAAC,MAAM;MACLK,OAAO,CAAC,EAAE,GAAGC,MAAM,GAAGN,GAAG,EAAEU,MAAM,CAACT,KAAK,CAAC,CAAC;IAC3C;EACF,CAAC,CAAC;AACJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { startSegmentCollection, setSegmentBytesLimit } from './segmentCollection';
|
|
2
|
-
export {
|
|
3
|
-
|
|
2
|
+
export { SEGMENT_BYTES_LIMIT } from './segmentCollection';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["startSegmentCollection","setSegmentBytesLimit","SEGMENT_BYTES_LIMIT"],"sources":["../../../../src/domain/replay/segmentCollection/index.js"],"sourcesContent":["export {\n startSegmentCollection,\n setSegmentBytesLimit\n} from './segmentCollection'\nexport { SEGMENT_BYTES_LIMIT } from './segmentCollection'\n"],"mappings":"AAAA,SACEA,sBAAsB,EACtBC,oBAAoB,QACf,qBAAqB;AAC5B,SAASC,mBAAmB,QAAQ,qBAAqB"}
|
|
@@ -1,96 +1,40 @@
|
|
|
1
|
-
import { assign
|
|
1
|
+
import { assign } from '@cloudcare/browser-core';
|
|
2
2
|
import { RecordType } from '../../../types';
|
|
3
3
|
import * as replayStats from '../replayStats';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export function Segment(worker, context, creationReason, initialRecord, onWrote, onFlushed) {
|
|
7
|
-
this.worker = worker;
|
|
8
|
-
this.pendingWriteCount = 0;
|
|
9
|
-
this.id = nextId++;
|
|
4
|
+
export function Segment(encoder, context, creationReason) {
|
|
5
|
+
this.encoder = encoder;
|
|
10
6
|
var viewId = context.view.id;
|
|
11
7
|
this.metadata = assign({
|
|
12
|
-
start:
|
|
13
|
-
end:
|
|
8
|
+
start: Infinity,
|
|
9
|
+
end: -Infinity,
|
|
14
10
|
creation_reason: creationReason,
|
|
15
|
-
records_count:
|
|
16
|
-
has_full_snapshot:
|
|
11
|
+
records_count: 0,
|
|
12
|
+
has_full_snapshot: false,
|
|
17
13
|
index_in_view: replayStats.getSegmentsCount(viewId),
|
|
18
14
|
source: 'browser'
|
|
19
15
|
}, context);
|
|
20
16
|
replayStats.addSegment(viewId);
|
|
21
|
-
replayStats.addRecord(viewId);
|
|
22
|
-
var rawBytesCount = 0;
|
|
23
|
-
var compressedBytesCount = 0;
|
|
24
|
-
var compressedData = [];
|
|
25
|
-
|
|
26
|
-
var _this = this;
|
|
27
|
-
|
|
28
|
-
var wokerListener = addEventListener(worker, 'message', function (params) {
|
|
29
|
-
var data = params.data;
|
|
30
|
-
|
|
31
|
-
if (data.type !== 'wrote') {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (data.id === _this.id) {
|
|
36
|
-
_this.pendingWriteCount -= 1;
|
|
37
|
-
replayStats.addWroteData(viewId, data.additionalBytesCount);
|
|
38
|
-
rawBytesCount += data.additionalBytesCount;
|
|
39
|
-
compressedBytesCount += data.result.length;
|
|
40
|
-
compressedData.push(data.result);
|
|
41
|
-
|
|
42
|
-
if (_this.flushReason && _this.pendingWriteCount === 0) {
|
|
43
|
-
compressedData.push(data.trailer);
|
|
44
|
-
onFlushed(concatBuffers(compressedData), rawBytesCount);
|
|
45
|
-
removeMessageListener();
|
|
46
|
-
} else {
|
|
47
|
-
onWrote(compressedBytesCount);
|
|
48
|
-
}
|
|
49
|
-
} else if (data.id > _this.id) {
|
|
50
|
-
// Messages should be received in the same order as they are sent, so if we receive a
|
|
51
|
-
// message with an id superior to this Segment instance id, we know that another, more
|
|
52
|
-
// recent Segment instance is being used.
|
|
53
|
-
//
|
|
54
|
-
// In theory, a "flush" response should have been received at this point, so the listener
|
|
55
|
-
// should already have been removed. But if something goes wrong and we didn't receive a
|
|
56
|
-
// "flush" response, remove the listener to avoid any leak, and send a monitor message to
|
|
57
|
-
// help investigate the issue.
|
|
58
|
-
removeMessageListener();
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
var removeMessageListener = wokerListener.stop; // worker.addEventListener('message', listener)
|
|
62
|
-
|
|
63
|
-
this.write('{"records":[' + JSON.stringify(initialRecord));
|
|
64
17
|
}
|
|
65
|
-
|
|
66
|
-
Segment.prototype.addRecord = function (record) {
|
|
18
|
+
Segment.prototype.addRecord = function (record, callback) {
|
|
67
19
|
this.metadata.start = Math.min(this.metadata.start, record.timestamp);
|
|
68
20
|
this.metadata.end = Math.max(this.metadata.end, record.timestamp);
|
|
69
21
|
this.metadata.records_count += 1;
|
|
70
|
-
replayStats.addRecord(this.metadata.view.id);
|
|
71
|
-
|
|
72
22
|
if (!this.metadata.has_full_snapshot) {
|
|
73
23
|
this.metadata.has_full_snapshot = record.type === RecordType.FullSnapshot;
|
|
74
24
|
}
|
|
75
|
-
|
|
76
|
-
this.
|
|
25
|
+
replayStats.addRecord(this.metadata.view.id);
|
|
26
|
+
var prefix = this.metadata.records_count === 1 ? '{"records":[' : ',';
|
|
27
|
+
this.encoder.write(prefix + JSON.stringify(record), callback);
|
|
77
28
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
29
|
+
Segment.prototype.flush = function (callback) {
|
|
30
|
+
if (this.metadata.records_count === 0) {
|
|
31
|
+
throw new Error('Empty segment flushed');
|
|
32
|
+
}
|
|
33
|
+
var _this = this;
|
|
34
|
+
this.encoder.write('],' + JSON.stringify(this.metadata).slice(1) + '\n', function () {
|
|
35
|
+
replayStats.addWroteData(_this.metadata.view.id, _this.encoder.getRawBytesCount());
|
|
36
|
+
callback(_this.metadata);
|
|
84
37
|
});
|
|
85
|
-
this.
|
|
38
|
+
this.encoder.reset();
|
|
86
39
|
};
|
|
87
|
-
|
|
88
|
-
Segment.prototype.write = function (data) {
|
|
89
|
-
this.pendingWriteCount += 1;
|
|
90
|
-
this.worker.postMessage({
|
|
91
|
-
data: data,
|
|
92
|
-
id: this.id,
|
|
93
|
-
streamId: STREAM_ID,
|
|
94
|
-
action: 'write'
|
|
95
|
-
});
|
|
96
|
-
};
|
|
40
|
+
//# sourceMappingURL=segment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment.js","names":["assign","RecordType","replayStats","Segment","encoder","context","creationReason","viewId","view","id","metadata","start","Infinity","end","creation_reason","records_count","has_full_snapshot","index_in_view","getSegmentsCount","source","addSegment","prototype","addRecord","record","callback","Math","min","timestamp","max","type","FullSnapshot","prefix","write","JSON","stringify","flush","Error","_this","slice","addWroteData","getRawBytesCount","reset"],"sources":["../../../../src/domain/replay/segmentCollection/segment.js"],"sourcesContent":["import { assign } from '@cloudcare/browser-core'\nimport { RecordType } from '../../../types'\nimport * as replayStats from '../replayStats'\n\nexport function Segment(encoder, context, creationReason) {\n this.encoder = encoder\n var viewId = context.view.id\n\n this.metadata = assign(\n {\n start: Infinity,\n end: -Infinity,\n creation_reason: creationReason,\n records_count: 0,\n has_full_snapshot: false,\n index_in_view: replayStats.getSegmentsCount(viewId),\n source: 'browser'\n },\n context\n )\n replayStats.addSegment(viewId)\n}\nSegment.prototype.addRecord = function (record, callback) {\n this.metadata.start = Math.min(this.metadata.start, record.timestamp)\n this.metadata.end = Math.max(this.metadata.end, record.timestamp)\n this.metadata.records_count += 1\n if (!this.metadata.has_full_snapshot) {\n this.metadata.has_full_snapshot = record.type === RecordType.FullSnapshot\n }\n replayStats.addRecord(this.metadata.view.id)\n const prefix = this.metadata.records_count === 1 ? '{\"records\":[' : ','\n this.encoder.write(prefix + JSON.stringify(record), callback)\n}\nSegment.prototype.flush = function (callback) {\n if (this.metadata.records_count === 0) {\n throw new Error('Empty segment flushed')\n }\n var _this = this\n this.encoder.write(\n '],' + JSON.stringify(this.metadata).slice(1) + '\\n',\n function () {\n replayStats.addWroteData(\n _this.metadata.view.id,\n _this.encoder.getRawBytesCount()\n )\n callback(_this.metadata)\n }\n )\n this.encoder.reset()\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,OAAO,KAAKC,WAAW,MAAM,gBAAgB;AAE7C,OAAO,SAASC,OAAOA,CAACC,OAAO,EAAEC,OAAO,EAAEC,cAAc,EAAE;EACxD,IAAI,CAACF,OAAO,GAAGA,OAAO;EACtB,IAAIG,MAAM,GAAGF,OAAO,CAACG,IAAI,CAACC,EAAE;EAE5B,IAAI,CAACC,QAAQ,GAAGV,MAAM,CACpB;IACEW,KAAK,EAAEC,QAAQ;IACfC,GAAG,EAAE,CAACD,QAAQ;IACdE,eAAe,EA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K,CAAC,uBAAuB,CAAC;EAC1C;EACA,IAAIC,KAAK,GAAG,IAAI;EAChB,IAAI,CAACjC,OAAO,CAAC4B,KAAK,CAChB,IAAI,GAAGC,IAAI,CAACC,SAAS,CAAC,IAAI,CAACxB,QAAQ,CAAC,CAAC4B,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,EACpD,YAAY;IACVpC,WAAW,CAACqC,YAAY,CACtBF,KAAK,CAAC3B,QAAQ,CAACF,IAAI,CAACC,EAAE,EACtB4B,KAAK,CAACjC,OAAO,CAACoC,gBAAgB,CAAC,CACjC,CAAC;IACDhB,QAAQ,CAACa,KAAK,CAAC3B,QAAQ,CAAC;EAC1B,CACF,CAAC;EACD,IAAI,CAACN,OAAO,CAACqC,KAAK,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -6,8 +6,9 @@ export var SEGMENT_DURATION_LIMIT = 30 * ONE_SECOND;
|
|
|
6
6
|
* beacon payload max queue size implementation is 64kb
|
|
7
7
|
* ensure that we leave room for logs, rum and potential other users
|
|
8
8
|
*/
|
|
9
|
+
export var SEGMENT_BYTES_LIMIT = 60000;
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
// Segments are the main data structure for session replays. They contain context information used
|
|
11
12
|
// for indexing or UI needs, and a list of records (RRWeb 'events', renamed to avoid confusing
|
|
12
13
|
// namings). They are stored without any processing from the intake, and fetched one after the
|
|
13
14
|
// other while a session is being replayed. Their encoding (deflate) are carefully crafted to allow
|
|
@@ -32,17 +33,17 @@ export var SEGMENT_BYTES_LIMIT = 60000; // Segments are the main data structure
|
|
|
32
33
|
// To help investigate session replays issues, each segment is created with a "creation reason",
|
|
33
34
|
// indicating why the session has been created.
|
|
34
35
|
|
|
35
|
-
export function startSegmentCollection(lifeCycle, configuration, sessionManager, viewContexts, httpRequest,
|
|
36
|
+
export function startSegmentCollection(lifeCycle, configuration, sessionManager, viewContexts, httpRequest, encoder) {
|
|
36
37
|
return doStartSegmentCollection(lifeCycle, function () {
|
|
37
38
|
return computeSegmentContext(configuration, sessionManager, viewContexts);
|
|
38
|
-
}, httpRequest,
|
|
39
|
+
}, httpRequest, encoder);
|
|
39
40
|
}
|
|
40
41
|
var SegmentCollectionStatus = {
|
|
41
42
|
WaitingForInitialRecord: 0,
|
|
42
43
|
SegmentPending: 1,
|
|
43
44
|
Stopped: 2
|
|
44
45
|
};
|
|
45
|
-
export function doStartSegmentCollection(lifeCycle, getSegmentContext, httpRequest,
|
|
46
|
+
export function doStartSegmentCollection(lifeCycle, getSegmentContext, httpRequest, encoder) {
|
|
46
47
|
var state = {
|
|
47
48
|
status: SegmentCollectionStatus.WaitingForInitialRecord,
|
|
48
49
|
nextSegmentCreationReason: 'init'
|
|
@@ -55,13 +56,18 @@ export function doStartSegmentCollection(lifeCycle, getSegmentContext, httpReque
|
|
|
55
56
|
flushSegment(pageExitEvent.reason);
|
|
56
57
|
});
|
|
57
58
|
var unsubscribePageExited = subscribePageExited.unsubscribe;
|
|
58
|
-
|
|
59
59
|
function flushSegment(flushReason) {
|
|
60
60
|
if (state.status === SegmentCollectionStatus.SegmentPending) {
|
|
61
|
-
state.segment.flush(
|
|
61
|
+
state.segment.flush(function (metadata) {
|
|
62
|
+
var payload = buildReplayPayload(encoder.getEncodedBytes(), metadata, encoder.getRawBytesCount());
|
|
63
|
+
if (isPageExitReason(flushReason)) {
|
|
64
|
+
httpRequest.sendOnExit(payload);
|
|
65
|
+
} else {
|
|
66
|
+
httpRequest.send(payload);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
62
69
|
clearTimeout(state.expirationTimeoutId);
|
|
63
70
|
}
|
|
64
|
-
|
|
65
71
|
if (flushReason !== 'stop') {
|
|
66
72
|
state = {
|
|
67
73
|
status: SegmentCollectionStatus.WaitingForInitialRecord,
|
|
@@ -73,47 +79,32 @@ export function doStartSegmentCollection(lifeCycle, getSegmentContext, httpReque
|
|
|
73
79
|
};
|
|
74
80
|
}
|
|
75
81
|
}
|
|
76
|
-
|
|
77
|
-
function createNewSegment(creationReason, initialRecord) {
|
|
78
|
-
var context = getSegmentContext();
|
|
79
|
-
|
|
80
|
-
if (!context) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
var segment = new Segment(worker, context, creationReason, initialRecord, function (compressedSegmentBytesCount) {
|
|
85
|
-
if (!segment.flushReason && compressedSegmentBytesCount > SEGMENT_BYTES_LIMIT) {
|
|
86
|
-
flushSegment('segment_bytes_limit');
|
|
87
|
-
}
|
|
88
|
-
}, function (data, rawSegmentBytesCount) {
|
|
89
|
-
var payload = buildReplayPayload(data, segment.metadata, rawSegmentBytesCount);
|
|
90
|
-
|
|
91
|
-
if (isPageExitReason(segment.flushReason)) {
|
|
92
|
-
httpRequest.sendOnExit(payload);
|
|
93
|
-
} else {
|
|
94
|
-
httpRequest.send(payload);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
state = {
|
|
98
|
-
status: SegmentCollectionStatus.SegmentPending,
|
|
99
|
-
segment: segment,
|
|
100
|
-
expirationTimeoutId: setTimeout(function () {
|
|
101
|
-
flushSegment('segment_duration_limit');
|
|
102
|
-
}, SEGMENT_DURATION_LIMIT)
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
82
|
return {
|
|
107
83
|
addRecord: function addRecord(record) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
createNewSegment(state.nextSegmentCreationReason, record);
|
|
111
|
-
break;
|
|
112
|
-
|
|
113
|
-
case SegmentCollectionStatus.SegmentPending:
|
|
114
|
-
state.segment.addRecord(record);
|
|
115
|
-
break;
|
|
84
|
+
if (state.status === SegmentCollectionStatus.Stopped) {
|
|
85
|
+
return;
|
|
116
86
|
}
|
|
87
|
+
if (state.status === SegmentCollectionStatus.WaitingForInitialRecord) {
|
|
88
|
+
var context = getSegmentContext();
|
|
89
|
+
if (!context) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
state = {
|
|
93
|
+
status: SegmentCollectionStatus.SegmentPending,
|
|
94
|
+
segment: new Segment(encoder, context, state.nextSegmentCreationReason),
|
|
95
|
+
expirationTimeoutId: setTimeout(function () {
|
|
96
|
+
flushSegment('segment_duration_limit');
|
|
97
|
+
}, SEGMENT_DURATION_LIMIT)
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
var segment = state.segment;
|
|
101
|
+
segment.addRecord(record, function () {
|
|
102
|
+
if (
|
|
103
|
+
// the written segment is still pending
|
|
104
|
+
state.status === SegmentCollectionStatus.SegmentPending && state.segment === segment && encoder.getEncodedBytesCount() > SEGMENT_BYTES_LIMIT) {
|
|
105
|
+
flushSegment('segment_bytes_limit');
|
|
106
|
+
}
|
|
107
|
+
});
|
|
117
108
|
},
|
|
118
109
|
stop: function stop() {
|
|
119
110
|
flushSegment('stop');
|
|
@@ -125,11 +116,9 @@ export function doStartSegmentCollection(lifeCycle, getSegmentContext, httpReque
|
|
|
125
116
|
export function computeSegmentContext(configuration, sessionManager, viewContexts) {
|
|
126
117
|
var session = sessionManager.findTrackedSession();
|
|
127
118
|
var viewContext = viewContexts.findView();
|
|
128
|
-
|
|
129
119
|
if (!session || !viewContext) {
|
|
130
120
|
return undefined;
|
|
131
121
|
}
|
|
132
|
-
|
|
133
122
|
return {
|
|
134
123
|
sdk: {
|
|
135
124
|
name: configuration.sdkName,
|
|
@@ -149,10 +138,8 @@ export function computeSegmentContext(configuration, sessionManager, viewContext
|
|
|
149
138
|
}
|
|
150
139
|
};
|
|
151
140
|
}
|
|
152
|
-
export function setSegmentBytesLimit(
|
|
153
|
-
|
|
154
|
-
newSegmentBytesLimit = 60000;
|
|
155
|
-
}
|
|
156
|
-
|
|
141
|
+
export function setSegmentBytesLimit() {
|
|
142
|
+
var newSegmentBytesLimit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 60000;
|
|
157
143
|
SEGMENT_BYTES_LIMIT = newSegmentBytesLimit;
|
|
158
|
-
}
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=segmentCollection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmentCollection.js","names":["ONE_SECOND","LifeCycleEventType","isPageExitReason","setTimeout","clearTimeout","buildReplayPayload","Segment","SEGMENT_DURATION_LIMIT","SEGMENT_BYTES_LIMIT","startSegmentCollection","lifeCycle","configuration","sessionManager","viewContexts","httpRequest","encoder","doStartSegmentCollection","computeSegmentContext","SegmentCollectionStatus","WaitingForInitialRecord","SegmentPending","Stopped","getSegmentContext","state","status","nextSegmentCreationReason","subscribeViewCreated","subscribe","VIEW_CREATED","flushSegment","unsubscribeViewCreated","unsubscribe","subscribePageExited","PAGE_EXITED","pageExitEvent","reason","unsubscribePageExited","flushReason","segment","flush","metadata","payload","getEncodedBytes","getRawBytesCount","sendOnExit","send","expirationTimeoutId","addRecord","record","context","getEncodedBytesCount","stop","session","findTrackedSession","viewContext","findView","undefined","sdk","name","sdkName","version","sdkVersion","env","service","app","id","applicationId","view","setSegmentBytesLimit","newSegmentBytesLimit","arguments","length"],"sources":["../../../../src/domain/replay/segmentCollection/segmentCollection.js"],"sourcesContent":["import {\n ONE_SECOND,\n LifeCycleEventType,\n isPageExitReason,\n setTimeout,\n clearTimeout\n} from '@cloudcare/browser-core'\nimport { buildReplayPayload } from './buildReplayPayload'\nimport { Segment } from './segment'\n\nexport var SEGMENT_DURATION_LIMIT = 30 * ONE_SECOND\n/**\n * beacon payload max queue size implementation is 64kb\n * ensure that we leave room for logs, rum and potential other users\n */\nexport var SEGMENT_BYTES_LIMIT = 60000\n\n// Segments are the main data structure for session replays. They contain context information used\n// for indexing or UI needs, and a list of records (RRWeb 'events', renamed to avoid confusing\n// namings). They are stored without any processing from the intake, and fetched one after the\n// other while a session is being replayed. Their encoding (deflate) are carefully crafted to allow\n// concatenating multiple segments together. Segments have a size overhead (metadata), so our goal is to\n// build segments containing as many records as possible while complying with the various flush\n// strategies to guarantee a good replay quality.\n//\n// When the recording starts, a segment is initially created. The segment is flushed (finalized and\n// sent) based on various events (non-exhaustive list):\n//\n// * the page visibility change or becomes to unload\n// * the segment duration reaches a limit\n// * the encoded segment bytes count reaches a limit\n// * ...\n//\n// A segment cannot be created without its context. If the RUM session ends and no session id is\n// available when creating a new segment, records will be ignored, until the session is renewed and\n// a new session id is available.\n//\n// Empty segments (segments with no record) aren't useful and should be ignored.\n//\n// To help investigate session replays issues, each segment is created with a \"creation reason\",\n// indicating why the session has been created.\n\nexport function startSegmentCollection(\n lifeCycle,\n configuration,\n sessionManager,\n viewContexts,\n httpRequest,\n encoder\n) {\n return doStartSegmentCollection(\n lifeCycle,\n function () {\n return computeSegmentContext(configuration, sessionManager, viewContexts)\n },\n httpRequest,\n encoder\n )\n}\n\nvar SegmentCollectionStatus = {\n WaitingForInitialRecord: 0,\n SegmentPending: 1,\n Stopped: 2\n}\n\nexport function doStartSegmentCollection(\n lifeCycle,\n getSegmentContext,\n httpRequest,\n encoder\n) {\n var state = {\n status: SegmentCollectionStatus.WaitingForInitialRecord,\n nextSegmentCreationReason: 'init'\n }\n var subscribeViewCreated = lifeCycle.subscribe(\n LifeCycleEventType.VIEW_CREATED,\n function () {\n flushSegment('view_change')\n }\n )\n var unsubscribeViewCreated = subscribeViewCreated.unsubscribe\n var subscribePageExited = lifeCycle.subscribe(\n LifeCycleEventType.PAGE_EXITED,\n function (pageExitEvent) {\n flushSegment(pageExitEvent.reason)\n }\n )\n var unsubscribePageExited = subscribePageExited.unsubscribe\n\n function flushSegment(flushReason) {\n if (state.status === SegmentCollectionStatus.SegmentPending) {\n state.segment.flush(function (metadata) {\n var payload = buildReplayPayload(\n encoder.getEncodedBytes(),\n metadata,\n encoder.getRawBytesCount()\n )\n\n if (isPageExitReason(flushReason)) {\n httpRequest.sendOnExit(payload)\n } else {\n httpRequest.send(payload)\n }\n })\n clearTimeout(state.expirationTimeoutId)\n }\n\n if (flushReason !== 'stop') {\n state = {\n status: SegmentCollectionStatus.WaitingForInitialRecord,\n nextSegmentCreationReason: flushReason\n }\n } else {\n state = {\n status: SegmentCollectionStatus.Stopped\n }\n }\n }\n\n return {\n addRecord: function (record) {\n if (state.status === SegmentCollectionStatus.Stopped) {\n return\n }\n\n if (state.status === SegmentCollectionStatus.WaitingForInitialRecord) {\n var context = getSegmentContext()\n if (!context) {\n return\n }\n\n state = {\n status: SegmentCollectionStatus.SegmentPending,\n segment: new Segment(\n encoder,\n context,\n state.nextSegmentCreationReason\n ),\n expirationTimeoutId: setTimeout(function () {\n flushSegment('segment_duration_limit')\n }, SEGMENT_DURATION_LIMIT)\n }\n }\n\n var segment = state.segment\n\n segment.addRecord(record, function () {\n if (\n // the written segment is still pending\n state.status === SegmentCollectionStatus.SegmentPending &&\n state.segment === segment &&\n encoder.getEncodedBytesCount() > SEGMENT_BYTES_LIMIT\n ) {\n flushSegment('segment_bytes_limit')\n }\n })\n },\n\n stop: function () {\n flushSegment('stop')\n unsubscribeViewCreated()\n unsubscribePageExited()\n }\n }\n}\n\nexport function computeSegmentContext(\n configuration,\n sessionManager,\n viewContexts\n) {\n var session = sessionManager.findTrackedSession()\n var viewContext = viewContexts.findView()\n if (!session || !viewContext) {\n return undefined\n }\n return {\n sdk: {\n name: configuration.sdkName,\n version: configuration.sdkVersion\n },\n env: configuration.env || '',\n service: viewContext.service || configuration.service || 'browser',\n version: viewContext.version || configuration.version || '',\n app: {\n id: configuration.applicationId\n },\n session: {\n id: session.id\n },\n view: {\n id: viewContext.id\n }\n }\n}\n\nexport function setSegmentBytesLimit(newSegmentBytesLimit = 60_000) {\n SEGMENT_BYTES_LIMIT = newSegmentBytesLimit\n}\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,kBAAkB,EAClBC,gBAAgB,EAChBC,UAAU,EACVC,YAAY,QACP,yBAAyB;AAChC,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,OAAO,QAAQ,WAAW;AAEnC,OAAO,IAAIC,sBAAsB,GAAG,EAAE,GAAGP,UAAU;AACnD;AACA;AACA;AACA;AACA,OAAO,IAAIQ,mBAAmB,GAA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AACW;IAClB;EACF,CAAC;AACH;AAEA,OAAO,SAASG,oBAAoBA,CAAA,EAAgC;EAAA,IAA/BC,oBAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAd,SAAA,GAAAc,SAAA,MAAG,KAAM;EAChE9D,mBAAmB,GAAG6D,oBAAoB;AAC5C"}
|
|
@@ -10,11 +10,9 @@ export function startRequestCollection(lifeCycle, configuration, sessionManager)
|
|
|
10
10
|
export function trackXhr(lifeCycle, configuration, tracer) {
|
|
11
11
|
var subscription = initXhrObservable().subscribe(function (rawContext) {
|
|
12
12
|
var context = rawContext;
|
|
13
|
-
|
|
14
13
|
if (!isAllowedRequestUrl(configuration, context.url)) {
|
|
15
14
|
return;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
switch (context.state) {
|
|
19
17
|
case 'start':
|
|
20
18
|
tracer.traceXhr(context, context.xhr);
|
|
@@ -24,7 +22,6 @@ export function trackXhr(lifeCycle, configuration, tracer) {
|
|
|
24
22
|
url: context.url
|
|
25
23
|
});
|
|
26
24
|
break;
|
|
27
|
-
|
|
28
25
|
case 'complete':
|
|
29
26
|
tracer.clearTracingIfNeeded(context);
|
|
30
27
|
lifeCycle.notify(LifeCycleEventType.REQUEST_COMPLETED, {
|
|
@@ -52,11 +49,9 @@ export function trackXhr(lifeCycle, configuration, tracer) {
|
|
|
52
49
|
export function trackFetch(lifeCycle, configuration, tracer) {
|
|
53
50
|
var subscription = initFetchObservable().subscribe(function (rawContext) {
|
|
54
51
|
var context = rawContext;
|
|
55
|
-
|
|
56
52
|
if (!isAllowedRequestUrl(configuration, context.url)) {
|
|
57
53
|
return;
|
|
58
54
|
}
|
|
59
|
-
|
|
60
55
|
switch (context.state) {
|
|
61
56
|
case 'start':
|
|
62
57
|
tracer.traceFetch(context);
|
|
@@ -66,7 +61,6 @@ export function trackFetch(lifeCycle, configuration, tracer) {
|
|
|
66
61
|
url: context.url
|
|
67
62
|
});
|
|
68
63
|
break;
|
|
69
|
-
|
|
70
64
|
case 'resolve':
|
|
71
65
|
waitForResponseToComplete(context, function (duration) {
|
|
72
66
|
tracer.clearTracingIfNeeded(context);
|
|
@@ -96,16 +90,13 @@ export function trackFetch(lifeCycle, configuration, tracer) {
|
|
|
96
90
|
}
|
|
97
91
|
};
|
|
98
92
|
}
|
|
99
|
-
|
|
100
93
|
function getNextRequestIndex() {
|
|
101
94
|
var result = nextRequestIndex;
|
|
102
95
|
nextRequestIndex += 1;
|
|
103
96
|
return result;
|
|
104
97
|
}
|
|
105
|
-
|
|
106
98
|
function waitForResponseToComplete(context, callback) {
|
|
107
99
|
var clonedResponse = context.response && tryToClone(context.response);
|
|
108
|
-
|
|
109
100
|
if (!clonedResponse || !clonedResponse.body) {
|
|
110
101
|
// do not try to wait for the response if the clone failed, fetch error or null body
|
|
111
102
|
callback(elapsed(context.startClocks.timeStamp, timeStampNow()));
|
|
@@ -117,4 +108,5 @@ function waitForResponseToComplete(context, callback) {
|
|
|
117
108
|
collectStreamBody: false
|
|
118
109
|
});
|
|
119
110
|
}
|
|
120
|
-
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=requestCollection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestCollection.js","names":["RequestType","initFetchObservable","initXhrObservable","LifeCycleEventType","tryToClone","readBytesFromStream","elapsed","timeStampNow","isAllowedRequestUrl","startTracer","nextRequestIndex","startRequestCollection","lifeCycle","configuration","sessionManager","tracer","trackXhr","trackFetch","subscription","subscribe","rawContext","context","url","state","traceXhr","xhr","requestIndex","getNextRequestIndex","notify","REQUEST_STARTED","clearTracingIfNeeded","REQUEST_COMPLETED","duration","method","spanId","startClocks","status","traceId","traceSampled","type","XHR","stop","unsubscribe","traceFetch","waitForResponseToComplete","responseType","FETCH","response","init","input","result","callback","clonedResponse","body","timeStamp","bytesLimit","Number","POSITIVE_INFINITY","collectStreamBody"],"sources":["../../src/domain/requestCollection.js"],"sourcesContent":["import {\n RequestType,\n initFetchObservable,\n initXhrObservable,\n LifeCycleEventType,\n tryToClone,\n readBytesFromStream,\n elapsed,\n timeStampNow\n} from '@cloudcare/browser-core'\nimport { isAllowedRequestUrl } from './rumEventsCollection/resource/resourceUtils'\nimport { startTracer } from './tracing/tracer'\n\nvar nextRequestIndex = 1\n\nexport function startRequestCollection(\n lifeCycle,\n configuration,\n sessionManager\n) {\n var tracer = startTracer(configuration, sessionManager)\n trackXhr(lifeCycle, configuration, tracer)\n trackFetch(lifeCycle, configuration, tracer)\n}\n\nexport function trackXhr(lifeCycle, configuration, tracer) {\n var subscription = initXhrObservable().subscribe(function (rawContext) {\n var context = rawContext\n if (!isAllowedRequestUrl(configuration, context.url)) {\n return\n }\n\n switch (context.state) {\n case 'start':\n tracer.traceXhr(context, context.xhr)\n context.requestIndex = getNextRequestIndex()\n\n lifeCycle.notify(LifeCycleEventType.REQUEST_STARTED, {\n requestIndex: context.requestIndex,\n url: context.url\n })\n break\n case 'complete':\n tracer.clearTracingIfNeeded(context)\n lifeCycle.notify(LifeCycleEventType.REQUEST_COMPLETED, {\n duration: context.duration,\n method: context.method,\n requestIndex: context.requestIndex,\n spanId: context.spanId,\n startClocks: context.startClocks,\n status: context.status,\n traceId: context.traceId,\n traceSampled: context.traceSampled,\n type: RequestType.XHR,\n url: context.url,\n xhr: context.xhr\n })\n break\n }\n })\n\n return {\n stop: function () {\n return subscription.unsubscribe()\n }\n }\n}\n\nexport function trackFetch(lifeCycle, configuration, tracer) {\n var subscription = initFetchObservable().subscribe(function (rawContext) {\n var context = rawContext\n if (!isAllowedRequestUrl(configuration, context.url)) {\n return\n }\n\n switch (context.state) {\n case 'start':\n tracer.traceFetch(context)\n context.requestIndex = getNextRequestIndex()\n\n lifeCycle.notify(LifeCycleEventType.REQUEST_STARTED, {\n requestIndex: context.requestIndex,\n url: context.url\n })\n break\n case 'resolve':\n waitForResponseToComplete(context, function (duration) {\n tracer.clearTracingIfNeeded(context)\n lifeCycle.notify(LifeCycleEventType.REQUEST_COMPLETED, {\n duration: duration,\n method: context.method,\n requestIndex: context.requestIndex,\n responseType: context.responseType,\n spanId: context.spanId,\n startClocks: context.startClocks,\n status: context.status,\n traceId: context.traceId,\n traceSampled: context.traceSampled,\n type: RequestType.FETCH,\n url: context.url,\n response: context.response,\n init: context.init,\n input: context.input\n })\n })\n break\n }\n })\n return {\n stop: function () {\n return subscription.unsubscribe()\n }\n }\n}\n\nfunction getNextRequestIndex() {\n var result = nextRequestIndex\n nextRequestIndex += 1\n return result\n}\n\nfunction waitForResponseToComplete(context, callback) {\n var clonedResponse = context.response && tryToClone(context.response)\n if (!clonedResponse || !clonedResponse.body) {\n // do not try to wait for the response if the clone failed, fetch error or null body\n callback(elapsed(context.startClocks.timeStamp, timeStampNow()))\n } else {\n readBytesFromStream(\n clonedResponse.body,\n function () {\n callback(elapsed(context.startClocks.timeStamp, timeStampNow()))\n },\n {\n bytesLimit: Number.POSITIVE_INFINITY,\n collectStreamBody: false\n }\n )\n }\n}\n"],"mappings":"AAAA,SACEA,WAAW,EACXC,mBAAmB,EACnBC,iBAAiB,EACjBC,kBAAkB,EAClBC,UAAU,EACVC,mBAAmB,EACnBC,OAAO,EACPC,YAAY,QACP,yBAAyB;AAChC,SAASC,mBAAmB,QAAQ,8CAA8C;AAClF,SAASC,WAAW,QAAQ,kBAAkB;AAE9C,IAAIC,gBAAgB,GAAG,CAAC;AAExB,OAAO,SAASC,sBAAsBA,CACpCC,SAAS,EACTC,aAAa,EACbC,cAAc,EACd;EACA,IAAIC,MAAM,GAAGN,WAAW,CAACI,aAAa,EAAEC,cAAc,CAAC;EACvDE,QAAQ,CAACJ,SAAS,EAAEC,aAAa,EAAEE,MAAM,CAAC;EAC1CE,UAAU,CAACL,SAAS,EAAEC,aAAa,EAAEE,MAAM,CAAC;AAC9C;AAEA,OAAO,SAASC,QAAQA,CAACJ,SAAS,EAAEC,aAAa,EAAEE,MAAM,EAAE;EACzD,IAAIG,YAAY,GAAGhB,iBAAiB,CAAC,CA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IAAI,EAAE3B,OAAO,CAAC2B,IAAI;YAClBC,KAAK,EAAE5B,OAAO,CAAC4B;UACjB,CAAC,CAAC;QACJ,CAAC,CAAC;QACF;IACJ;EACF,CAAC,CAAC;EACF,OAAO;IACLR,IAAI,EAAE,SAAAA,KAAA,EAAY;MAChB,OAAOvB,YAAY,CAACwB,WAAW,CAAC,CAAC;IACnC;EACF,CAAC;AACH;AAEA,SAASf,mBAAmBA,CAAA,EAAG;EAC7B,IAAIuB,MAAM,GAAGxC,gBAAgB;EAC7BA,gBAAgB,IAAI,CAAC;EACrB,OAAOwC,MAAM;AACf;AAEA,SAASN,yBAAyBA,CAACvB,OAAO,EAAE8B,QAAQ,EAAE;EACpD,IAAIC,cAAc,GAAG/B,OAAO,CAAC0B,QAAQ,IAAI3C,UAAU,CAACiB,OAAO,CAAC0B,QAAQ,CAAC;EACrE,IAAI,CAACK,cAAc,IAAI,CAACA,cAAc,CAACC,IAAI,EAAE;IAC3C;IACAF,QAAQ,CAAC7C,OAAO,CAACe,OAAO,CAACc,WAAW,CAACmB,SAAS,EAAE/C,YAAY,CAAC,CAAC,CAAC,CAAC;EAClE,CAAC,MAAM;IACLF,mBAAmB,CACjB+C,cAAc,CAACC,IAAI,EACnB,YAAY;MACVF,QAAQ,CAAC7C,OAAO,CAACe,OAAO,CAACc,WAAW,CAACmB,SAAS,EAAE/C,YAAY,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC,EACD;MACEgD,UAAU,EAAEC,MAAM,CAACC,iBAAiB;MACpCC,iBAAiB,EAAE;IACrB,CACF,CAAC;EACH;AACF"}
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
import { toServerDuration, extend, extend2Lev, ActionType, RumEventType, LifeCycleEventType, UUID, noop } from '@cloudcare/browser-core';
|
|
2
2
|
import { trackClickActions } from './trackClickActions';
|
|
3
|
-
export function startActionCollection(lifeCycle, domMutationObservable, configuration,
|
|
3
|
+
export function startActionCollection(lifeCycle, domMutationObservable, configuration, pageStateHistory) {
|
|
4
4
|
lifeCycle.subscribe(LifeCycleEventType.AUTO_ACTION_COMPLETED, function (action) {
|
|
5
|
-
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processAction(action,
|
|
5
|
+
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processAction(action, pageStateHistory));
|
|
6
6
|
});
|
|
7
7
|
var actionContexts = {
|
|
8
|
-
findActionId: noop
|
|
8
|
+
findActionId: noop,
|
|
9
|
+
findAllActionId: noop
|
|
9
10
|
};
|
|
10
|
-
|
|
11
11
|
if (configuration.trackUserInteractions) {
|
|
12
12
|
actionContexts = trackClickActions(lifeCycle, domMutationObservable, configuration).actionContexts;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
14
|
return {
|
|
16
15
|
actionContexts: actionContexts,
|
|
17
16
|
addAction: function addAction(action, savedCommonContext) {
|
|
18
17
|
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, extend({
|
|
19
18
|
savedCommonContext: savedCommonContext
|
|
20
|
-
}, processAction(action,
|
|
19
|
+
}, processAction(action, pageStateHistory)));
|
|
21
20
|
}
|
|
22
21
|
};
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
function processAction(action, foregroundContexts) {
|
|
23
|
+
function processAction(action, pageStateHistory) {
|
|
26
24
|
var autoActionProperties = isAutoAction(action) ? {
|
|
27
25
|
action: {
|
|
28
26
|
error: {
|
|
@@ -61,16 +59,11 @@ function processAction(action, foregroundContexts) {
|
|
|
61
59
|
type: action.type
|
|
62
60
|
},
|
|
63
61
|
date: action.startClocks.timeStamp,
|
|
64
|
-
type: RumEventType.ACTION
|
|
62
|
+
type: RumEventType.ACTION,
|
|
63
|
+
view: {
|
|
64
|
+
in_foreground: pageStateHistory.isInActivePageStateAt(action.startClocks.relative)
|
|
65
|
+
}
|
|
65
66
|
}, autoActionProperties);
|
|
66
|
-
var inForeground = foregroundContexts.isInForegroundAt(action.startClocks.relative);
|
|
67
|
-
|
|
68
|
-
if (inForeground !== undefined) {
|
|
69
|
-
actionEvent.view = {
|
|
70
|
-
in_foreground: inForeground
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
67
|
return {
|
|
75
68
|
customerContext: customerContext,
|
|
76
69
|
rawRumEvent: actionEvent,
|
|
@@ -81,7 +74,7 @@ function processAction(action, foregroundContexts) {
|
|
|
81
74
|
} : {}
|
|
82
75
|
};
|
|
83
76
|
}
|
|
84
|
-
|
|
85
77
|
function isAutoAction(action) {
|
|
86
78
|
return action.type !== ActionType.CUSTOM;
|
|
87
|
-
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=actionCollection.js.map
|