@cloudcare/browser-rum-slim 3.3.3
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 +21 -0
- package/README.md +15 -0
- package/bundle/dataflux-rum-slim.js +1 -0
- package/cjs/boot/buildEnv.js +11 -0
- package/cjs/boot/buildEnv.js.map +1 -0
- package/cjs/boot/perStartRum.js +227 -0
- package/cjs/boot/perStartRum.js.map +1 -0
- package/cjs/boot/rum.js +180 -0
- package/cjs/boot/rum.js.map +1 -0
- package/cjs/boot/rum.slim.entry.js +13 -0
- package/cjs/boot/rum.slim.entry.js.map +1 -0
- package/cjs/boot/rumEntryFactory.js +15 -0
- package/cjs/boot/rumEntryFactory.js.map +1 -0
- package/cjs/boot/rumPublicApi.js +285 -0
- package/cjs/boot/rumPublicApi.js.map +1 -0
- package/cjs/boot/rumRecorderApiStub.js +19 -0
- package/cjs/boot/rumRecorderApiStub.js.map +1 -0
- package/cjs/boot/rumSlimConfiguration.js +16 -0
- package/cjs/boot/rumSlimConfiguration.js.map +1 -0
- package/cjs/constants.js +41 -0
- package/cjs/constants.js.map +1 -0
- package/cjs/domain/assembly.js +172 -0
- package/cjs/domain/assembly.js.map +1 -0
- package/cjs/domain/configuration.js +272 -0
- package/cjs/domain/configuration.js.map +1 -0
- package/cjs/domain/contexts/commonContext.js +14 -0
- package/cjs/domain/contexts/commonContext.js.map +1 -0
- package/cjs/domain/contexts/displayContext.js +22 -0
- package/cjs/domain/contexts/displayContext.js.map +1 -0
- package/cjs/domain/contexts/foregroundContexts.js +111 -0
- package/cjs/domain/contexts/foregroundContexts.js.map +1 -0
- package/cjs/domain/contexts/internalContext.js +47 -0
- package/cjs/domain/contexts/internalContext.js.map +1 -0
- package/cjs/domain/contexts/pageStateHistory.js +111 -0
- package/cjs/domain/contexts/pageStateHistory.js.map +1 -0
- package/cjs/domain/contexts/urlContexts.js +73 -0
- package/cjs/domain/contexts/urlContexts.js.map +1 -0
- package/cjs/domain/contexts/viewContexts.js +51 -0
- package/cjs/domain/contexts/viewContexts.js.map +1 -0
- package/cjs/domain/domMutationObservable.js +69 -0
- package/cjs/domain/domMutationObservable.js.map +1 -0
- package/cjs/domain/encoderStreamId.js +11 -0
- package/cjs/domain/encoderStreamId.js.map +1 -0
- package/cjs/domain/firstInputPolyfill.js +83 -0
- package/cjs/domain/firstInputPolyfill.js.map +1 -0
- package/cjs/domain/initViewportObservable.js +44 -0
- package/cjs/domain/initViewportObservable.js.map +1 -0
- package/cjs/domain/locationChangeObservable.js +57 -0
- package/cjs/domain/locationChangeObservable.js.map +1 -0
- package/cjs/domain/performanceObservable.js +124 -0
- package/cjs/domain/performanceObservable.js.map +1 -0
- package/cjs/domain/performanceUtils.js +47 -0
- package/cjs/domain/performanceUtils.js.map +1 -0
- package/cjs/domain/requestCollection.js +127 -0
- package/cjs/domain/requestCollection.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/actionCollection.js +89 -0
- package/cjs/domain/rumEventsCollection/actions/actionCollection.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/clickChain.js +69 -0
- package/cjs/domain/rumEventsCollection/actions/clickChain.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/computeFrustration.js +75 -0
- package/cjs/domain/rumEventsCollection/actions/computeFrustration.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js +232 -0
- package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/getSelectorsFromElement.js +220 -0
- package/cjs/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/interactionSelectorCache.js +28 -0
- package/cjs/domain/rumEventsCollection/actions/interactionSelectorCache.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js +73 -0
- package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -0
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js +253 -0
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -0
- package/cjs/domain/rumEventsCollection/error/errorCollection.js +90 -0
- package/cjs/domain/rumEventsCollection/error/errorCollection.js.map +1 -0
- package/cjs/domain/rumEventsCollection/error/trackConsoleError.js +18 -0
- package/cjs/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -0
- package/cjs/domain/rumEventsCollection/error/trackReportError.js +25 -0
- package/cjs/domain/rumEventsCollection/error/trackReportError.js.map +1 -0
- package/cjs/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js +61 -0
- package/cjs/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js.map +1 -0
- package/cjs/domain/rumEventsCollection/longTask/longTaskCollection.js +44 -0
- package/cjs/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -0
- package/cjs/domain/rumEventsCollection/resource/matchRequestResourceEntry.js +74 -0
- package/cjs/domain/rumEventsCollection/resource/matchRequestResourceEntry.js.map +1 -0
- package/cjs/domain/rumEventsCollection/resource/resourceCollection.js +239 -0
- package/cjs/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -0
- package/cjs/domain/rumEventsCollection/resource/resourceTrackerManager.js +237 -0
- package/cjs/domain/rumEventsCollection/resource/resourceTrackerManager.js.map +1 -0
- package/cjs/domain/rumEventsCollection/resource/resourceUtils.js +240 -0
- package/cjs/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -0
- package/cjs/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +25 -0
- package/cjs/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/interactionCountPolyfill.js +54 -0
- package/cjs/domain/rumEventsCollection/view/interactionCountPolyfill.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js +48 -0
- package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +125 -0
- package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +27 -0
- package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackFirstHidden.js +55 -0
- package/cjs/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackFirstInput.js +47 -0
- package/cjs/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js +51 -0
- package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +162 -0
- package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +61 -0
- package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackLoadingTime.js +51 -0
- package/cjs/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js +57 -0
- package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackScrollMetrics.js +92 -0
- package/cjs/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackViewEventCounts.js +21 -0
- package/cjs/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackViews.js +269 -0
- package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/viewCollection.js +131 -0
- package/cjs/domain/rumEventsCollection/view/viewCollection.js.map +1 -0
- package/cjs/domain/rumSessionManager.js +187 -0
- package/cjs/domain/rumSessionManager.js.map +1 -0
- package/cjs/domain/tracing/ddtraceTracer.js +46 -0
- package/cjs/domain/tracing/ddtraceTracer.js.map +1 -0
- package/cjs/domain/tracing/getDocumentTraceId.js +80 -0
- package/cjs/domain/tracing/getDocumentTraceId.js.map +1 -0
- package/cjs/domain/tracing/jaegerTracer.js +48 -0
- package/cjs/domain/tracing/jaegerTracer.js.map +1 -0
- package/cjs/domain/tracing/sampler.js +69 -0
- package/cjs/domain/tracing/sampler.js.map +1 -0
- package/cjs/domain/tracing/skywalkingTracer.js +96 -0
- package/cjs/domain/tracing/skywalkingTracer.js.map +1 -0
- package/cjs/domain/tracing/traceIdentifier.js +66 -0
- package/cjs/domain/tracing/traceIdentifier.js.map +1 -0
- package/cjs/domain/tracing/tracer.js +133 -0
- package/cjs/domain/tracing/tracer.js.map +1 -0
- package/cjs/domain/tracing/w3cTraceParentTracer.js +74 -0
- package/cjs/domain/tracing/w3cTraceParentTracer.js.map +1 -0
- package/cjs/domain/tracing/zipkinMultiTracer.js +48 -0
- package/cjs/domain/tracing/zipkinMultiTracer.js.map +1 -0
- package/cjs/domain/tracing/zipkinSingleTracer.js +47 -0
- package/cjs/domain/tracing/zipkinSingleTracer.js.map +1 -0
- package/cjs/domain/trackEventCounts.js +55 -0
- package/cjs/domain/trackEventCounts.js.map +1 -0
- package/cjs/domain/usr/index.js +44 -0
- package/cjs/domain/usr/index.js.map +1 -0
- package/cjs/domain/waitPageActivityEnd.js +151 -0
- package/cjs/domain/waitPageActivityEnd.js.map +1 -0
- package/cjs/index.js +13 -0
- package/cjs/index.js.map +1 -0
- package/cjs/transport/startRumBatch.js +26 -0
- package/cjs/transport/startRumBatch.js.map +1 -0
- package/cjs/transport/startRumEventBridge.js +15 -0
- package/cjs/transport/startRumEventBridge.js.map +1 -0
- package/esm/boot/buildEnv.js +5 -0
- package/esm/boot/buildEnv.js.map +1 -0
- package/esm/boot/perStartRum.js +221 -0
- package/esm/boot/perStartRum.js.map +1 -0
- package/esm/boot/rum.js +173 -0
- package/esm/boot/rum.js.map +1 -0
- package/esm/boot/rum.slim.entry.js +7 -0
- package/esm/boot/rum.slim.entry.js.map +1 -0
- package/esm/boot/rumEntryFactory.js +9 -0
- package/esm/boot/rumEntryFactory.js.map +1 -0
- package/esm/boot/rumPublicApi.js +279 -0
- package/esm/boot/rumPublicApi.js.map +1 -0
- package/esm/boot/rumRecorderApiStub.js +13 -0
- package/esm/boot/rumRecorderApiStub.js.map +1 -0
- package/esm/boot/rumSlimConfiguration.js +10 -0
- package/esm/boot/rumSlimConfiguration.js.map +1 -0
- package/esm/constants.js +35 -0
- package/esm/constants.js.map +1 -0
- package/esm/domain/assembly.js +166 -0
- package/esm/domain/assembly.js.map +1 -0
- package/esm/domain/configuration.js +266 -0
- package/esm/domain/configuration.js.map +1 -0
- package/esm/domain/contexts/commonContext.js +8 -0
- package/esm/domain/contexts/commonContext.js.map +1 -0
- package/esm/domain/contexts/displayContext.js +16 -0
- package/esm/domain/contexts/displayContext.js.map +1 -0
- package/esm/domain/contexts/foregroundContexts.js +103 -0
- package/esm/domain/contexts/foregroundContexts.js.map +1 -0
- package/esm/domain/contexts/internalContext.js +41 -0
- package/esm/domain/contexts/internalContext.js.map +1 -0
- package/esm/domain/contexts/pageStateHistory.js +104 -0
- package/esm/domain/contexts/pageStateHistory.js.map +1 -0
- package/esm/domain/contexts/urlContexts.js +67 -0
- package/esm/domain/contexts/urlContexts.js.map +1 -0
- package/esm/domain/contexts/viewContexts.js +44 -0
- package/esm/domain/contexts/viewContexts.js.map +1 -0
- package/esm/domain/domMutationObservable.js +62 -0
- package/esm/domain/domMutationObservable.js.map +1 -0
- package/esm/domain/encoderStreamId.js +5 -0
- package/esm/domain/encoderStreamId.js.map +1 -0
- package/esm/domain/firstInputPolyfill.js +77 -0
- package/esm/domain/firstInputPolyfill.js.map +1 -0
- package/esm/domain/initViewportObservable.js +36 -0
- package/esm/domain/initViewportObservable.js.map +1 -0
- package/esm/domain/locationChangeObservable.js +51 -0
- package/esm/domain/locationChangeObservable.js.map +1 -0
- package/esm/domain/performanceObservable.js +116 -0
- package/esm/domain/performanceObservable.js.map +1 -0
- package/esm/domain/performanceUtils.js +40 -0
- package/esm/domain/performanceUtils.js.map +1 -0
- package/esm/domain/requestCollection.js +119 -0
- package/esm/domain/requestCollection.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/actionCollection.js +83 -0
- package/esm/domain/rumEventsCollection/actions/actionCollection.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/clickChain.js +62 -0
- package/esm/domain/rumEventsCollection/actions/clickChain.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/computeFrustration.js +67 -0
- package/esm/domain/rumEventsCollection/actions/computeFrustration.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js +225 -0
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js +212 -0
- package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js +20 -0
- package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/listenActionEvents.js +67 -0
- package/esm/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -0
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js +244 -0
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -0
- package/esm/domain/rumEventsCollection/error/errorCollection.js +83 -0
- package/esm/domain/rumEventsCollection/error/errorCollection.js.map +1 -0
- package/esm/domain/rumEventsCollection/error/trackConsoleError.js +12 -0
- package/esm/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -0
- package/esm/domain/rumEventsCollection/error/trackReportError.js +19 -0
- package/esm/domain/rumEventsCollection/error/trackReportError.js.map +1 -0
- package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js +55 -0
- package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js.map +1 -0
- package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js +38 -0
- package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -0
- package/esm/domain/rumEventsCollection/resource/matchRequestResourceEntry.js +69 -0
- package/esm/domain/rumEventsCollection/resource/matchRequestResourceEntry.js.map +1 -0
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js +233 -0
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -0
- package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js +231 -0
- package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js.map +1 -0
- package/esm/domain/rumEventsCollection/resource/resourceUtils.js +218 -0
- package/esm/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -0
- package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +19 -0
- package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.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 +42 -0
- package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +117 -0
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +20 -0
- package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackFirstHidden.js +49 -0
- package/esm/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackFirstInput.js +41 -0
- package/esm/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js +44 -0
- package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +153 -0
- package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +54 -0
- package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackLoadingTime.js +45 -0
- package/esm/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js +51 -0
- package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js +84 -0
- package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js +15 -0
- package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackViews.js +262 -0
- package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/viewCollection.js +125 -0
- package/esm/domain/rumEventsCollection/view/viewCollection.js.map +1 -0
- package/esm/domain/rumSessionManager.js +179 -0
- package/esm/domain/rumSessionManager.js.map +1 -0
- package/esm/domain/tracing/ddtraceTracer.js +40 -0
- package/esm/domain/tracing/ddtraceTracer.js.map +1 -0
- package/esm/domain/tracing/getDocumentTraceId.js +69 -0
- package/esm/domain/tracing/getDocumentTraceId.js.map +1 -0
- package/esm/domain/tracing/jaegerTracer.js +42 -0
- package/esm/domain/tracing/jaegerTracer.js.map +1 -0
- package/esm/domain/tracing/sampler.js +61 -0
- package/esm/domain/tracing/sampler.js.map +1 -0
- package/esm/domain/tracing/skywalkingTracer.js +90 -0
- package/esm/domain/tracing/skywalkingTracer.js.map +1 -0
- package/esm/domain/tracing/traceIdentifier.js +57 -0
- package/esm/domain/tracing/traceIdentifier.js.map +1 -0
- package/esm/domain/tracing/tracer.js +124 -0
- package/esm/domain/tracing/tracer.js.map +1 -0
- package/esm/domain/tracing/w3cTraceParentTracer.js +69 -0
- package/esm/domain/tracing/w3cTraceParentTracer.js.map +1 -0
- package/esm/domain/tracing/zipkinMultiTracer.js +42 -0
- package/esm/domain/tracing/zipkinMultiTracer.js.map +1 -0
- package/esm/domain/tracing/zipkinSingleTracer.js +41 -0
- package/esm/domain/tracing/zipkinSingleTracer.js.map +1 -0
- package/esm/domain/trackEventCounts.js +49 -0
- package/esm/domain/trackEventCounts.js.map +1 -0
- package/esm/domain/usr/index.js +38 -0
- package/esm/domain/usr/index.js.map +1 -0
- package/esm/domain/waitPageActivityEnd.js +142 -0
- package/esm/domain/waitPageActivityEnd.js.map +1 -0
- package/esm/index.js +3 -0
- package/esm/index.js.map +1 -0
- package/esm/transport/startRumBatch.js +20 -0
- package/esm/transport/startRumBatch.js.map +1 -0
- package/esm/transport/startRumEventBridge.js +9 -0
- package/esm/transport/startRumEventBridge.js.map +1 -0
- package/package.json +39 -0
- package/types/index.d.ts +134 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { TraceIdentifier, getCrypto } from './traceIdentifier';
|
|
2
|
+
import { assign, getType } from '@cloudcare/browser-core';
|
|
3
|
+
|
|
4
|
+
// === Generate a random 64-bit number in fixed-length hex format
|
|
5
|
+
function randomTraceId() {
|
|
6
|
+
var digits = '0123456789abcdef';
|
|
7
|
+
var n = '';
|
|
8
|
+
for (var i = 0; i < 16; i += 1) {
|
|
9
|
+
var rand = Math.floor(Math.random() * 16);
|
|
10
|
+
n += digits[rand];
|
|
11
|
+
}
|
|
12
|
+
return n;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param {*} traceSampled
|
|
17
|
+
* @param {*} isHexTraceId
|
|
18
|
+
*/
|
|
19
|
+
export function W3cTraceParentTracer(configuration, traceSampled, isHexTraceId) {
|
|
20
|
+
this._traceId = new TraceIdentifier();
|
|
21
|
+
this._spanId = new TraceIdentifier();
|
|
22
|
+
this._traceSampled = traceSampled;
|
|
23
|
+
this.isHexTraceId = isHexTraceId;
|
|
24
|
+
if (configuration.generateTraceId && getType(configuration.generateTraceId) === 'function') {
|
|
25
|
+
var customTraceId = configuration.generateTraceId();
|
|
26
|
+
if (getType(customTraceId) === 'string') {
|
|
27
|
+
this.customTraceId = customTraceId;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
W3cTraceParentTracer.prototype = {
|
|
32
|
+
isTracingSupported: function isTracingSupported() {
|
|
33
|
+
return getCrypto() !== undefined;
|
|
34
|
+
},
|
|
35
|
+
getSpanId: function getSpanId() {
|
|
36
|
+
return this.isHexTraceId ? this._spanId.toDecimalString() : this._spanId.toPaddedHexadecimalString();
|
|
37
|
+
},
|
|
38
|
+
getTraceId: function getTraceId() {
|
|
39
|
+
if (this.customTraceId) {
|
|
40
|
+
return this.customTraceId;
|
|
41
|
+
}
|
|
42
|
+
if (this.isHexTraceId) {
|
|
43
|
+
return this._traceId.toDecimalString();
|
|
44
|
+
} else {
|
|
45
|
+
return this._traceId.toPaddedHexadecimalString() + this._spanId.toPaddedHexadecimalString();
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
getTraceParent: function getTraceParent() {
|
|
49
|
+
// '{version}-{traceId}-{spanId}-{sampleDecision}'
|
|
50
|
+
if (this.isHexTraceId) {
|
|
51
|
+
return '00-0000000000000000' + this._traceId.toPaddedHexadecimalString() + '-' + this._spanId.toPaddedHexadecimalString() + '-' + (this._traceSampled ? '01' : '00');
|
|
52
|
+
} else {
|
|
53
|
+
return '00-' + this.getTraceId() + '-' + this.getSpanId() + '-' + (this._traceSampled ? '01' : '00');
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
makeTracingHeaders: function makeTracingHeaders() {
|
|
57
|
+
var baseHeaders = {
|
|
58
|
+
traceparent: this.getTraceParent()
|
|
59
|
+
};
|
|
60
|
+
if (this.isHexTraceId) {
|
|
61
|
+
return assign(baseHeaders, {
|
|
62
|
+
'x-gc-trace-id': this.getTraceId(),
|
|
63
|
+
'x-gc-span-id': this.getSpanId()
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return baseHeaders;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=w3cTraceParentTracer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"w3cTraceParentTracer.js","names":["TraceIdentifier","getCrypto","assign","getType","randomTraceId","digits","n","i","rand","Math","floor","random","W3cTraceParentTracer","configuration","traceSampled","isHexTraceId","_traceId","_spanId","_traceSampled","generateTraceId","customTraceId","prototype","isTracingSupported","undefined","getSpanId","toDecimalString","toPaddedHexadecimalString","getTraceId","getTraceParent","makeTracingHeaders","baseHeaders","traceparent"],"sources":["../../../../rum/src/domain/tracing/w3cTraceParentTracer.js"],"sourcesContent":["import { TraceIdentifier, getCrypto } from './traceIdentifier'\nimport { assign, getType } from '@cloudcare/browser-core'\n\n// === Generate a random 64-bit number in fixed-length hex format\nfunction randomTraceId() {\n var digits = '0123456789abcdef'\n var n = ''\n for (var i = 0; i < 16; i += 1) {\n var rand = Math.floor(Math.random() * 16)\n n += digits[rand]\n }\n return n\n}\n/**\n *\n * @param {*} traceSampled\n * @param {*} isHexTraceId\n */\nexport function W3cTraceParentTracer(\n configuration,\n traceSampled,\n isHexTraceId\n) {\n this._traceId = new TraceIdentifier()\n this._spanId = new TraceIdentifier()\n this._traceSampled = traceSampled\n this.isHexTraceId = isHexTraceId\n if (\n configuration.generateTraceId &&\n getType(configuration.generateTraceId) === 'function'\n ) {\n const customTraceId = configuration.generateTraceId()\n if (getType(customTraceId) === 'string') {\n this.customTraceId = customTraceId\n }\n }\n}\nW3cTraceParentTracer.prototype = {\n isTracingSupported: function () {\n return getCrypto() !== undefined\n },\n getSpanId: function () {\n return this.isHexTraceId\n ? this._spanId.toDecimalString()\n : this._spanId.toPaddedHexadecimalString()\n },\n getTraceId: function () {\n if (this.customTraceId) {\n return this.customTraceId\n }\n if (this.isHexTraceId) {\n return this._traceId.toDecimalString()\n } else {\n return (\n this._traceId.toPaddedHexadecimalString() +\n this._spanId.toPaddedHexadecimalString()\n )\n }\n },\n getTraceParent: function () {\n // '{version}-{traceId}-{spanId}-{sampleDecision}'\n if (this.isHexTraceId) {\n return (\n '00-0000000000000000' +\n this._traceId.toPaddedHexadecimalString() +\n '-' +\n this._spanId.toPaddedHexadecimalString() +\n '-' +\n (this._traceSampled ? '01' : '00')\n )\n } else {\n return (\n '00-' +\n this.getTraceId() +\n '-' +\n this.getSpanId() +\n '-' +\n (this._traceSampled ? '01' : '00')\n )\n }\n },\n makeTracingHeaders: function () {\n var baseHeaders = {\n traceparent: this.getTraceParent()\n }\n if (this.isHexTraceId) {\n return assign(baseHeaders, {\n 'x-gc-trace-id': this.getTraceId(),\n 'x-gc-span-id': this.getSpanId()\n })\n }\n return baseHeaders\n }\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createRandomHexIdentifier, getCrypto, normalizeHexIdentifier } from './traceIdentifier';
|
|
2
|
+
import { getType } from '@cloudcare/browser-core';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {*} configuration
|
|
6
|
+
*/
|
|
7
|
+
export function ZipkinMultiTracer(configuration, traceSampled) {
|
|
8
|
+
this._traceId = configuration.traceId128Bit ? createRandomHexIdentifier(16) : createRandomHexIdentifier(8);
|
|
9
|
+
this._spanId = createRandomHexIdentifier(8);
|
|
10
|
+
this._traceSampled = traceSampled;
|
|
11
|
+
this.is128Bit = configuration.traceId128Bit;
|
|
12
|
+
if (configuration.generateTraceId && getType(configuration.generateTraceId) === 'function') {
|
|
13
|
+
var customTraceId = normalizeHexIdentifier(configuration.generateTraceId(), [16, 32]);
|
|
14
|
+
if (customTraceId) {
|
|
15
|
+
this.customTraceId = customTraceId;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
ZipkinMultiTracer.prototype = {
|
|
20
|
+
isTracingSupported: function isTracingSupported() {
|
|
21
|
+
return getCrypto() !== undefined;
|
|
22
|
+
},
|
|
23
|
+
getSpanId: function getSpanId() {
|
|
24
|
+
return this._spanId;
|
|
25
|
+
},
|
|
26
|
+
getTraceId: function getTraceId() {
|
|
27
|
+
if (this.customTraceId) {
|
|
28
|
+
return this.customTraceId;
|
|
29
|
+
}
|
|
30
|
+
return this._traceId;
|
|
31
|
+
},
|
|
32
|
+
makeTracingHeaders: function makeTracingHeaders() {
|
|
33
|
+
return {
|
|
34
|
+
'X-B3-TraceId': this.getTraceId(),
|
|
35
|
+
'X-B3-SpanId': this.getSpanId(),
|
|
36
|
+
// 'X-B3-ParentSpanId': '',
|
|
37
|
+
'X-B3-Sampled': this._traceSampled ? '1' : '0'
|
|
38
|
+
// 'X-B3-Flags': '0'
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=zipkinMultiTracer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zipkinMultiTracer.js","names":["createRandomHexIdentifier","getCrypto","normalizeHexIdentifier","getType","ZipkinMultiTracer","configuration","traceSampled","_traceId","traceId128Bit","_spanId","_traceSampled","is128Bit","generateTraceId","customTraceId","prototype","isTracingSupported","undefined","getSpanId","getTraceId","makeTracingHeaders"],"sources":["../../../../rum/src/domain/tracing/zipkinMultiTracer.js"],"sourcesContent":["import {\n createRandomHexIdentifier,\n getCrypto,\n normalizeHexIdentifier\n} from './traceIdentifier'\nimport { getType } from '@cloudcare/browser-core'\n/**\n *\n * @param {*} configuration\n */\nexport function ZipkinMultiTracer(configuration, traceSampled) {\n this._traceId = configuration.traceId128Bit\n ? createRandomHexIdentifier(16)\n : createRandomHexIdentifier(8)\n this._spanId = createRandomHexIdentifier(8)\n this._traceSampled = traceSampled\n this.is128Bit = configuration.traceId128Bit\n if (\n configuration.generateTraceId &&\n getType(configuration.generateTraceId) === 'function'\n ) {\n const customTraceId = normalizeHexIdentifier(\n configuration.generateTraceId(),\n [16, 32]\n )\n if (customTraceId) {\n this.customTraceId = customTraceId\n }\n }\n}\nZipkinMultiTracer.prototype = {\n isTracingSupported: function () {\n return getCrypto() !== undefined\n },\n getSpanId: function () {\n return this._spanId\n },\n getTraceId: function () {\n if (this.customTraceId) {\n return this.customTraceId\n }\n return this._traceId\n },\n\n makeTracingHeaders: function () {\n return {\n 'X-B3-TraceId': this.getTraceId(),\n 'X-B3-SpanId': this.getSpanId(),\n // 'X-B3-ParentSpanId': '',\n 'X-B3-Sampled': this._traceSampled ? '1' : '0'\n // 'X-B3-Flags': '0'\n }\n }\n}\n"],"mappings":"AAAA,SACEA,yBAAyB,EACzBC,SAAS,EACTC,sBAAsB,QACjB,mBAAmB;AAC1B,SAASC,OAAO,QAAQ,yBAAyB;AACjD;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,aAAa,EAAEC,YAAY,EAAE;EAC7D,IAAI,CAACC,QAAQ,GAAGF,aAAa,CAACG,aAAa,GACvCR,yBAAyB,CAAC,EAAE,CAAC,GAC7BA,yBAAyB,CAAC,CAAC,CAAC;EAChC,IAAI,CAACS,OAAO,GAAGT,yBAAyB,CAAC,CAAC,CAAC;EAC3C,IAAI,CAACU,aAAa,GAAGJ,YAAY;EACjC,IAAI,CAACK,QAAQ,GAAGN,aAAa,CAACG,aAAa;EAC3C,IACEH,aAAa,CAACO,eAAe,IAC7BT,OAAO,CAACE,aAAa,CAACO,eAAe,CAAC,KAAK,UAAU,EACrD;IACA,IAAMC,aAAa,GAAGX,sBAAsB,CAC1CG,aAAa,CAACO,eAAe,CAAC,CAAC,EAC/B,CAAC,EAAE,EAAE,EAAE,CACT,CAAC;IACD,IAAIC,aAAa,EAAE;MACjB,IAAI,CAACA,aAAa,GAAGA,aAAa;IACpC;EACF;AACF;AACAT,iBAAiB,CAACU,SAAS,GAAG;EAC5BC,kBAAkB,EAAE,SAApBA,kBAAkBA,CAAA,EAAc;IAC9B,OAAOd,SAAS,CAAC,CAAC,KAAKe,SAAS;EAClC,CAAC;EACDC,SAAS,EAAE,SAAXA,SAASA,CAAA,EAAc;IACrB,OAAO,IAAI,CAACR,OAAO;EACrB,CAAC;EACDS,UAAU,EAAE,SAAZA,UAAUA,CAAA,EAAc;IACtB,IAAI,IAAI,CAACL,aAAa,EAAE;MACtB,OAAO,IAAI,CAACA,aAAa;IAC3B;IACA,OAAO,IAAI,CAACN,QAAQ;EACtB,CAAC;EAEDY,kBAAkB,EAAE,SAApBA,kBAAkBA,CAAA,EAAc;IAC9B,OAAO;MACL,cAAc,EAAE,IAAI,CAACD,UAAU,CAAC,CAAC;MACjC,aAAa,EAAE,IAAI,CAACD,SAAS,CAAC,CAAC;MAC/B;MACA,cAAc,EAAE,IAAI,CAACP,aAAa,GAAG,GAAG,GAAG;MAC3C;IACF,CAAC;EACH;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createRandomHexIdentifier, getCrypto, normalizeHexIdentifier } from './traceIdentifier';
|
|
2
|
+
import { getType } from '@cloudcare/browser-core';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {*} configuration
|
|
6
|
+
*/
|
|
7
|
+
export function ZipkinSingleTracer(configuration, traceSampled) {
|
|
8
|
+
this._traceId = createRandomHexIdentifier(8);
|
|
9
|
+
this._spanId = createRandomHexIdentifier(8);
|
|
10
|
+
this._traceSampled = traceSampled;
|
|
11
|
+
if (configuration.generateTraceId && getType(configuration.generateTraceId) === 'function') {
|
|
12
|
+
var customTraceId = normalizeHexIdentifier(configuration.generateTraceId(), [16, 32]);
|
|
13
|
+
if (customTraceId) {
|
|
14
|
+
this.customTraceId = customTraceId;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
ZipkinSingleTracer.prototype = {
|
|
19
|
+
isTracingSupported: function isTracingSupported() {
|
|
20
|
+
return getCrypto() !== undefined;
|
|
21
|
+
},
|
|
22
|
+
getSpanId: function getSpanId() {
|
|
23
|
+
return this._spanId;
|
|
24
|
+
},
|
|
25
|
+
getTraceId: function getTraceId() {
|
|
26
|
+
if (this.customTraceId) {
|
|
27
|
+
return this.customTraceId;
|
|
28
|
+
}
|
|
29
|
+
return this._traceId;
|
|
30
|
+
},
|
|
31
|
+
getB3Str: function getB3Str() {
|
|
32
|
+
//{TraceId}-{SpanId}-{SamplingState}-{ParentSpanId}
|
|
33
|
+
return this.getTraceId() + '-' + this.getSpanId() + '-' + (this._traceSampled ? '1' : '0');
|
|
34
|
+
},
|
|
35
|
+
makeTracingHeaders: function makeTracingHeaders() {
|
|
36
|
+
return {
|
|
37
|
+
b3: this.getB3Str()
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=zipkinSingleTracer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zipkinSingleTracer.js","names":["createRandomHexIdentifier","getCrypto","normalizeHexIdentifier","getType","ZipkinSingleTracer","configuration","traceSampled","_traceId","_spanId","_traceSampled","generateTraceId","customTraceId","prototype","isTracingSupported","undefined","getSpanId","getTraceId","getB3Str","makeTracingHeaders","b3"],"sources":["../../../../rum/src/domain/tracing/zipkinSingleTracer.js"],"sourcesContent":["import {\n createRandomHexIdentifier,\n getCrypto,\n normalizeHexIdentifier\n} from './traceIdentifier'\nimport { getType } from '@cloudcare/browser-core'\n/**\n *\n * @param {*} configuration\n */\nexport function ZipkinSingleTracer(configuration, traceSampled) {\n this._traceId = createRandomHexIdentifier(8)\n this._spanId = createRandomHexIdentifier(8)\n this._traceSampled = traceSampled\n if (\n configuration.generateTraceId &&\n getType(configuration.generateTraceId) === 'function'\n ) {\n const customTraceId = normalizeHexIdentifier(\n configuration.generateTraceId(),\n [16, 32]\n )\n if (customTraceId) {\n this.customTraceId = customTraceId\n }\n }\n}\nZipkinSingleTracer.prototype = {\n isTracingSupported: function () {\n return getCrypto() !== undefined\n },\n getSpanId: function () {\n return this._spanId\n },\n getTraceId: function () {\n if (this.customTraceId) {\n return this.customTraceId\n }\n return this._traceId\n },\n getB3Str: function () {\n //{TraceId}-{SpanId}-{SamplingState}-{ParentSpanId}\n return (\n this.getTraceId() +\n '-' +\n this.getSpanId() +\n '-' +\n (this._traceSampled ? '1' : '0')\n )\n },\n makeTracingHeaders: function () {\n return {\n b3: this.getB3Str()\n }\n }\n}\n"],"mappings":"AAAA,SACEA,yBAAyB,EACzBC,SAAS,EACTC,sBAAsB,QACjB,mBAAmB;AAC1B,SAASC,OAAO,QAAQ,yBAAyB;AACjD;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAACC,aAAa,EAAEC,YAAY,EAAE;EAC9D,IAAI,CAACC,QAAQ,GAAGP,yBAAyB,CAAC,CAAC,CAAC;EAC5C,IAAI,CAACQ,OAAO,GAAGR,yBAAyB,CAAC,CAAC,CAAC;EAC3C,IAAI,CAACS,aAAa,GAAGH,YAAY;EACjC,IACED,aAAa,CAACK,eAAe,IAC7BP,OAAO,CAACE,aAAa,CAACK,eAAe,CAAC,KAAK,UAAU,EACrD;IACA,IAAMC,aAAa,GAAGT,sBAAsB,CAC1CG,aAAa,CAACK,eAAe,CAAC,CAAC,EAC/B,CAAC,EAAE,EAAE,EAAE,CACT,CAAC;IACD,IAAIC,aAAa,EAAE;MACjB,IAAI,CAACA,aAAa,GAAGA,aAAa;IACpC;EACF;AACF;AACAP,kBAAkB,CAACQ,SAAS,GAAG;EAC7BC,kBAAkB,EAAE,SAApBA,kBAAkBA,CAAA,EAAc;IAC9B,OAAOZ,SAAS,CAAC,CAAC,KAAKa,SAAS;EAClC,CAAC;EACDC,SAAS,EAAE,SAAXA,SAASA,CAAA,EAAc;IACrB,OAAO,IAAI,CAACP,OAAO;EACrB,CAAC;EACDQ,UAAU,EAAE,SAAZA,UAAUA,CAAA,EAAc;IACtB,IAAI,IAAI,CAACL,aAAa,EAAE;MACtB,OAAO,IAAI,CAACA,aAAa;IAC3B;IACA,OAAO,IAAI,CAACJ,QAAQ;EACtB,CAAC;EACDU,QAAQ,EAAE,SAAVA,QAAQA,CAAA,EAAc;IACpB;IACA,OACE,IAAI,CAACD,UAAU,CAAC,CAAC,GACjB,GAAG,GACH,IAAI,CAACD,SAAS,CAAC,CAAC,GAChB,GAAG,IACF,IAAI,CAACN,aAAa,GAAG,GAAG,GAAG,GAAG,CAAC;EAEpC,CAAC;EACDS,kBAAkB,EAAE,SAApBA,kBAAkBA,CAAA,EAAc;IAC9B,OAAO;MACLC,EAAE,EAAE,IAAI,CAACF,QAAQ,CAAC;IACpB,CAAC;EACH;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { noop, RumEventType, LifeCycleEventType } from '@cloudcare/browser-core';
|
|
2
|
+
export function trackEventCounts(data) {
|
|
3
|
+
var lifeCycle = data.lifeCycle;
|
|
4
|
+
var isChildEvent = data.isChildEvent;
|
|
5
|
+
var callback = data.onChange;
|
|
6
|
+
if (callback === undefined) {
|
|
7
|
+
callback = noop;
|
|
8
|
+
}
|
|
9
|
+
var eventCounts = {
|
|
10
|
+
errorCount: 0,
|
|
11
|
+
longTaskCount: 0,
|
|
12
|
+
resourceCount: 0,
|
|
13
|
+
actionCount: 0,
|
|
14
|
+
frustrationCount: 0
|
|
15
|
+
};
|
|
16
|
+
var subscription = lifeCycle.subscribe(LifeCycleEventType.RUM_EVENT_COLLECTED, function (event) {
|
|
17
|
+
if (event.type === RumEventType.VIEW || !isChildEvent(event)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
switch (event.type) {
|
|
21
|
+
case RumEventType.ERROR:
|
|
22
|
+
eventCounts.errorCount += 1;
|
|
23
|
+
callback();
|
|
24
|
+
break;
|
|
25
|
+
case RumEventType.ACTION:
|
|
26
|
+
if (event.action.frustration) {
|
|
27
|
+
eventCounts.frustrationCount += event.action.frustration.type.length;
|
|
28
|
+
}
|
|
29
|
+
eventCounts.actionCount += 1;
|
|
30
|
+
callback();
|
|
31
|
+
break;
|
|
32
|
+
case RumEventType.LONG_TASK:
|
|
33
|
+
eventCounts.longTaskCount += 1;
|
|
34
|
+
callback();
|
|
35
|
+
break;
|
|
36
|
+
case RumEventType.RESOURCE:
|
|
37
|
+
eventCounts.resourceCount += 1;
|
|
38
|
+
callback();
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
stop: function stop() {
|
|
44
|
+
subscription.unsubscribe();
|
|
45
|
+
},
|
|
46
|
+
eventCounts: eventCounts
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=trackEventCounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackEventCounts.js","names":["noop","RumEventType","LifeCycleEventType","trackEventCounts","data","lifeCycle","isChildEvent","callback","onChange","undefined","eventCounts","errorCount","longTaskCount","resourceCount","actionCount","frustrationCount","subscription","subscribe","RUM_EVENT_COLLECTED","event","type","VIEW","ERROR","ACTION","action","frustration","length","LONG_TASK","RESOURCE","stop","unsubscribe"],"sources":["../../../rum/src/domain/trackEventCounts.js"],"sourcesContent":["import { noop, RumEventType, LifeCycleEventType } from '@cloudcare/browser-core'\n\nexport function trackEventCounts(data) {\n var lifeCycle = data.lifeCycle\n var isChildEvent = data.isChildEvent\n var callback = data.onChange\n if (callback === undefined) {\n callback = noop\n }\n var eventCounts = {\n errorCount: 0,\n longTaskCount: 0,\n resourceCount: 0,\n actionCount: 0,\n frustrationCount: 0\n }\n\n var subscription = lifeCycle.subscribe(\n LifeCycleEventType.RUM_EVENT_COLLECTED,\n function (event) {\n if (event.type === RumEventType.VIEW || !isChildEvent(event)) {\n return\n }\n switch (event.type) {\n case RumEventType.ERROR:\n eventCounts.errorCount += 1\n\n callback()\n break\n case RumEventType.ACTION:\n if (event.action.frustration) {\n eventCounts.frustrationCount += event.action.frustration.type.length\n }\n eventCounts.actionCount += 1\n callback()\n break\n case RumEventType.LONG_TASK:\n eventCounts.longTaskCount += 1\n callback()\n break\n case RumEventType.RESOURCE:\n eventCounts.resourceCount += 1\n callback()\n break\n }\n }\n )\n\n return {\n stop: function () {\n subscription.unsubscribe()\n },\n eventCounts: eventCounts\n }\n}\n"],"mappings":"AAAA,SAASA,IAAI,EAAEC,YAAY,EAAEC,kBAAkB,QAAQ,yBAAyB;AAEhF,OAAO,SAASC,gBAAgBA,CAACC,IAAI,EAAE;EACrC,IAAIC,SAAS,GAAGD,IAAI,CAACC,SAAS;EAC9B,IAAIC,YAAY,GAAGF,IAAI,CAACE,YAAY;EACpC,IAAIC,QAAQ,GAAGH,IAAI,CAACI,QAAQ;EAC5B,IAAID,QAAQ,KAAKE,SAAS,EAAE;IAC1BF,QAAQ,GAAGP,IAAI;EACjB;EACA,IAAIU,WAAW,GAAG;IAChBC,UAAU,EAAE,CAAC;IACbC,aAAa,EAAE,CAAC;IAChBC,aAAa,EAAE,CAAC;IAChBC,WAAW,EAAE,CAAC;IACdC,gBAAgB,EAAE;EACpB,CAAC;EAED,IAAIC,YAAY,GAAGX,SAAS,CAACY,SAAS,CACpCf,kBAAkB,CAACgB,mBAAmB,EACtC,UAAUC,KAAK,EAAE;IACf,IAAIA,KAAK,CAACC,IAAI,KAAKnB,YAAY,CAACoB,IAAI,IAAI,CAACf,YAAY,CAACa,KAAK,CAAC,EAAE;MAC5D;IACF;IACA,QAAQA,KAAK,CAACC,IAAI;MAChB,KAAKnB,YAAY,CAACqB,KAAK;QACrBZ,WAAW,CAACC,UAAU,IAAI,CAAC;QAE3BJ,QAAQ,CAAC,CAAC;QACV;MACF,KAAKN,YAAY,CAACsB,MAAM;QACtB,IAAIJ,KAAK,CAACK,MAAM,CAACC,WAAW,EAAE;UAC5Bf,WAAW,CAACK,gBAAgB,IAAII,KAAK,CAACK,MAAM,CAACC,WAAW,CAACL,IAAI,CAACM,MAAM;QACtE;QACAhB,WAAW,CAACI,WAAW,IAAI,CAAC;QAC5BP,QAAQ,CAAC,CAAC;QACV;MACF,KAAKN,YAAY,CAAC0B,SAAS;QACzBjB,WAAW,CAACE,aAAa,IAAI,CAAC;QAC9BL,QAAQ,CAAC,CAAC;QACV;MACF,KAAKN,YAAY,CAAC2B,QAAQ;QACxBlB,WAAW,CAACG,aAAa,IAAI,CAAC;QAC9BN,QAAQ,CAAC,CAAC;QACV;IACJ;EACF,CACF,CAAC;EAED,OAAO;IACLsB,IAAI,EAAE,SAANA,IAAIA,CAAA,EAAc;MAChBb,YAAY,CAACc,WAAW,CAAC,CAAC;IAC5B,CAAC;IACDpB,WAAW,EAAEA;EACf,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getCookie, setCookie, UUID, ONE_HOUR, noop, SessionPersistence } from '@cloudcare/browser-core';
|
|
2
|
+
export var USR_ID_COOKIE_NAME = '_gc_usr_id';
|
|
3
|
+
export var ANONYMOUS_ID_EXPIRATION = 60 * 24 * ONE_HOUR;
|
|
4
|
+
function initUsrCookie(cookieOptions) {
|
|
5
|
+
var usrCacheId = getCookie(USR_ID_COOKIE_NAME, cookieOptions);
|
|
6
|
+
if (!usrCacheId) {
|
|
7
|
+
usrCacheId = UUID();
|
|
8
|
+
setCookie(USR_ID_COOKIE_NAME, usrCacheId, ANONYMOUS_ID_EXPIRATION, cookieOptions);
|
|
9
|
+
}
|
|
10
|
+
return usrCacheId;
|
|
11
|
+
}
|
|
12
|
+
function initUsrLocalStorage() {
|
|
13
|
+
var usrCacheId = localStorage.getItem(USR_ID_COOKIE_NAME);
|
|
14
|
+
if (!usrCacheId) {
|
|
15
|
+
usrCacheId = UUID();
|
|
16
|
+
localStorage.setItem(USR_ID_COOKIE_NAME, usrCacheId);
|
|
17
|
+
}
|
|
18
|
+
return usrCacheId;
|
|
19
|
+
}
|
|
20
|
+
export var startCacheUsrCache = function startCacheUsrCache(configuration) {
|
|
21
|
+
if (!configuration.sessionStoreStrategyType) {
|
|
22
|
+
return {
|
|
23
|
+
getId: noop
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
var usrCacheId;
|
|
27
|
+
if (configuration.sessionStoreStrategyType.type === SessionPersistence.COOKIE) {
|
|
28
|
+
usrCacheId = initUsrCookie(configuration.sessionStoreStrategyType.cookieOptions);
|
|
29
|
+
} else {
|
|
30
|
+
usrCacheId = initUsrLocalStorage();
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
getId: function getId() {
|
|
34
|
+
return usrCacheId;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["getCookie","setCookie","UUID","ONE_HOUR","noop","SessionPersistence","USR_ID_COOKIE_NAME","ANONYMOUS_ID_EXPIRATION","initUsrCookie","cookieOptions","usrCacheId","initUsrLocalStorage","localStorage","getItem","setItem","startCacheUsrCache","configuration","sessionStoreStrategyType","getId","type","COOKIE"],"sources":["../../../../rum/src/domain/usr/index.js"],"sourcesContent":["import {\n getCookie,\n setCookie,\n UUID,\n ONE_HOUR,\n noop,\n SessionPersistence\n} from '@cloudcare/browser-core'\nexport var USR_ID_COOKIE_NAME = '_gc_usr_id'\nexport var ANONYMOUS_ID_EXPIRATION = 60 * 24 * ONE_HOUR\n\nfunction initUsrCookie(cookieOptions) {\n var usrCacheId = getCookie(USR_ID_COOKIE_NAME, cookieOptions)\n if (!usrCacheId) {\n usrCacheId = UUID()\n setCookie(\n USR_ID_COOKIE_NAME,\n usrCacheId,\n ANONYMOUS_ID_EXPIRATION,\n cookieOptions\n )\n }\n return usrCacheId\n}\nfunction initUsrLocalStorage() {\n var usrCacheId = localStorage.getItem(USR_ID_COOKIE_NAME)\n if (!usrCacheId) {\n usrCacheId = UUID()\n localStorage.setItem(USR_ID_COOKIE_NAME, usrCacheId)\n }\n return usrCacheId\n}\nexport var startCacheUsrCache = function (configuration) {\n if (!configuration.sessionStoreStrategyType) {\n return {\n getId: noop\n }\n }\n\n let usrCacheId\n if (\n configuration.sessionStoreStrategyType.type === SessionPersistence.COOKIE\n ) {\n usrCacheId = initUsrCookie(\n configuration.sessionStoreStrategyType.cookieOptions\n )\n } else {\n usrCacheId = initUsrLocalStorage()\n }\n\n return {\n getId: function () {\n return usrCacheId\n }\n }\n}\n"],"mappings":"AAAA,SACEA,SAAS,EACTC,SAAS,EACTC,IAAI,EACJC,QAAQ,EACRC,IAAI,EACJC,kBAAkB,QACb,yBAAyB;AAChC,OAAO,IAAIC,kBAAkB,GAAG,YAAY;AAC5C,OAAO,IAAIC,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAGJ,QAAQ;AAEvD,SAASK,aAAaA,CAACC,aAAa,EAAE;EACpC,IAAIC,UAAU,GAAGV,SAAS,CAACM,kBAAkB,EAAEG,aAAa,CAAC;EAC7D,IAAI,CAACC,UAAU,EAAE;IACfA,UAAU,GAAGR,IAAI,CAAC,CAAC;IACnBD,SAAS,CACPK,kBAAkB,EAClBI,UAAU,EACVH,uBAAuB,EACvBE,aACF,CAAC;EACH;EACA,OAAOC,UAAU;AACnB;AACA,SAASC,mBAAmBA,CAAA,EAAG;EAC7B,IAAID,UAAU,GAAGE,YAAY,CAACC,OAAO,CAACP,kBAAkB,CAAC;EACzD,IAAI,CAACI,UAAU,EAAE;IACfA,UAAU,GAAGR,IAAI,CAAC,CAAC;IACnBU,YAAY,CAACE,OAAO,CAACR,kBAAkB,EAAEI,UAAU,CAAC;EACtD;EACA,OAAOA,UAAU;AACnB;AACA,OAAO,IAAIK,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAaC,aAAa,EAAE;EACvD,IAAI,CAACA,aAAa,CAACC,wBAAwB,EAAE;IAC3C,OAAO;MACLC,KAAK,EAAEd;IACT,CAAC;EACH;EAEA,IAAIM,UAAU;EACd,IACEM,aAAa,CAACC,wBAAwB,CAACE,IAAI,KAAKd,kBAAkB,CAACe,MAAM,EACzE;IACAV,UAAU,GAAGF,aAAa,CACxBQ,aAAa,CAACC,wBAAwB,CAACR,aACzC,CAAC;EACH,CAAC,MAAM;IACLC,UAAU,GAAGC,mBAAmB,CAAC,CAAC;EACpC;EAEA,OAAO;IACLO,KAAK,EAAE,SAAPA,KAAKA,CAAA,EAAc;MACjB,OAAOR,UAAU;IACnB;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Observable, each, timeStampNow, LifeCycleEventType, some, matchList, instrumentMethod, setTimeout, clearTimeout } from '@cloudcare/browser-core';
|
|
2
|
+
import { createPerformanceObservable, RumPerformanceEntryType } from '../domain/performanceObservable';
|
|
3
|
+
// Delay to wait for a page activity to validate the tracking process
|
|
4
|
+
export var PAGE_ACTIVITY_VALIDATION_DELAY = 100;
|
|
5
|
+
// Delay to wait after a page activity to end the tracking process
|
|
6
|
+
export var PAGE_ACTIVITY_END_DELAY = 100;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Wait for the page activity end
|
|
10
|
+
*
|
|
11
|
+
* Detection lifecycle:
|
|
12
|
+
* ```
|
|
13
|
+
* Wait page activity end
|
|
14
|
+
* .-------------------'--------------------.
|
|
15
|
+
* v v
|
|
16
|
+
* [Wait for a page activity ] [Wait for a maximum duration]
|
|
17
|
+
* [timeout: VALIDATION_DELAY] [ timeout: maxDuration ]
|
|
18
|
+
* / \ |
|
|
19
|
+
* v v |
|
|
20
|
+
* [No page activity] [Page activity] |
|
|
21
|
+
* | |,----------------------. |
|
|
22
|
+
* v v | |
|
|
23
|
+
* (Discard) [Wait for a page activity] | |
|
|
24
|
+
* [ timeout: END_DELAY ] | |
|
|
25
|
+
* / \ | |
|
|
26
|
+
* v v | |
|
|
27
|
+
* [No page activity] [Page activity] | |
|
|
28
|
+
* | | | |
|
|
29
|
+
* | '------------' |
|
|
30
|
+
* '-----------. ,--------------------'
|
|
31
|
+
* v
|
|
32
|
+
* (End)
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* Note: by assuming that maxDuration is greater than VALIDATION_DELAY, we are sure that if the
|
|
36
|
+
* process is still alive after maxDuration, it has been validated.
|
|
37
|
+
*/
|
|
38
|
+
export function waitPageActivityEnd(lifeCycle, domMutationObservable, configuration, pageActivityEndCallback, maxDuration) {
|
|
39
|
+
var pageActivityObservable = createPageActivityObservable(lifeCycle, domMutationObservable, configuration);
|
|
40
|
+
return doWaitPageActivityEnd(pageActivityObservable, pageActivityEndCallback, maxDuration);
|
|
41
|
+
}
|
|
42
|
+
export function doWaitPageActivityEnd(pageActivityObservable, pageActivityEndCallback, maxDuration) {
|
|
43
|
+
var pageActivityEndTimeoutId;
|
|
44
|
+
var hasCompleted = false;
|
|
45
|
+
var validationTimeoutId = setTimeout(function () {
|
|
46
|
+
complete({
|
|
47
|
+
hadActivity: false
|
|
48
|
+
});
|
|
49
|
+
}, PAGE_ACTIVITY_VALIDATION_DELAY);
|
|
50
|
+
var maxDurationTimeoutId = maxDuration !== undefined ? setTimeout(function () {
|
|
51
|
+
return complete({
|
|
52
|
+
hadActivity: true,
|
|
53
|
+
end: timeStampNow()
|
|
54
|
+
});
|
|
55
|
+
}, maxDuration) : undefined;
|
|
56
|
+
var pageActivitySubscription = pageActivityObservable.subscribe(function (data) {
|
|
57
|
+
var isBusy = data.isBusy;
|
|
58
|
+
clearTimeout(validationTimeoutId);
|
|
59
|
+
clearTimeout(pageActivityEndTimeoutId);
|
|
60
|
+
var lastChangeTime = timeStampNow();
|
|
61
|
+
if (!isBusy) {
|
|
62
|
+
pageActivityEndTimeoutId = setTimeout(function () {
|
|
63
|
+
complete({
|
|
64
|
+
hadActivity: true,
|
|
65
|
+
end: lastChangeTime
|
|
66
|
+
});
|
|
67
|
+
}, PAGE_ACTIVITY_END_DELAY);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
var stop = function stop() {
|
|
71
|
+
hasCompleted = true;
|
|
72
|
+
clearTimeout(validationTimeoutId);
|
|
73
|
+
clearTimeout(pageActivityEndTimeoutId);
|
|
74
|
+
clearTimeout(maxDurationTimeoutId);
|
|
75
|
+
pageActivitySubscription.unsubscribe();
|
|
76
|
+
};
|
|
77
|
+
function complete(event) {
|
|
78
|
+
if (hasCompleted) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
stop && stop();
|
|
82
|
+
pageActivityEndCallback(event);
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
stop: stop
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export function createPageActivityObservable(lifeCycle, domMutationObservable, configuration) {
|
|
89
|
+
return new Observable(function (observable) {
|
|
90
|
+
var subscriptions = [];
|
|
91
|
+
var firstRequestIndex;
|
|
92
|
+
var pendingRequestsCount = 0;
|
|
93
|
+
subscriptions.push(domMutationObservable.subscribe(function () {
|
|
94
|
+
notifyPageActivity();
|
|
95
|
+
}), createPerformanceObservable(configuration, {
|
|
96
|
+
type: RumPerformanceEntryType.RESOURCE
|
|
97
|
+
}).subscribe(function (entries) {
|
|
98
|
+
if (some(entries, function (entry) {
|
|
99
|
+
return !isExcludedUrl(configuration, entry.name);
|
|
100
|
+
})) {
|
|
101
|
+
notifyPageActivity();
|
|
102
|
+
}
|
|
103
|
+
}), lifeCycle.subscribe(LifeCycleEventType.REQUEST_STARTED, function (startEvent) {
|
|
104
|
+
if (isExcludedUrl(configuration, startEvent.url)) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (firstRequestIndex === undefined) {
|
|
108
|
+
firstRequestIndex = startEvent.requestIndex;
|
|
109
|
+
}
|
|
110
|
+
pendingRequestsCount += 1;
|
|
111
|
+
notifyPageActivity();
|
|
112
|
+
}), lifeCycle.subscribe(LifeCycleEventType.REQUEST_COMPLETED, function (request) {
|
|
113
|
+
if (isExcludedUrl(configuration, request.url) || firstRequestIndex === undefined ||
|
|
114
|
+
// If the request started before the tracking start, ignore it
|
|
115
|
+
request.requestIndex < firstRequestIndex) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
pendingRequestsCount -= 1;
|
|
119
|
+
notifyPageActivity();
|
|
120
|
+
}));
|
|
121
|
+
var _trackWindowOpen = trackWindowOpen(notifyPageActivity);
|
|
122
|
+
var stopTrackingWindowOpen = _trackWindowOpen.stop;
|
|
123
|
+
return function () {
|
|
124
|
+
stopTrackingWindowOpen();
|
|
125
|
+
each(subscriptions, function (s) {
|
|
126
|
+
s.unsubscribe();
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
function notifyPageActivity() {
|
|
130
|
+
observable.notify({
|
|
131
|
+
isBusy: pendingRequestsCount > 0
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function isExcludedUrl(configuration, requestUrl) {
|
|
137
|
+
return matchList(configuration.excludedActivityUrls, requestUrl);
|
|
138
|
+
}
|
|
139
|
+
function trackWindowOpen(callback) {
|
|
140
|
+
return instrumentMethod(window, 'open', callback);
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=waitPageActivityEnd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"waitPageActivityEnd.js","names":["Observable","each","timeStampNow","LifeCycleEventType","some","matchList","instrumentMethod","setTimeout","clearTimeout","createPerformanceObservable","RumPerformanceEntryType","PAGE_ACTIVITY_VALIDATION_DELAY","PAGE_ACTIVITY_END_DELAY","waitPageActivityEnd","lifeCycle","domMutationObservable","configuration","pageActivityEndCallback","maxDuration","pageActivityObservable","createPageActivityObservable","doWaitPageActivityEnd","pageActivityEndTimeoutId","hasCompleted","validationTimeoutId","complete","hadActivity","maxDurationTimeoutId","undefined","end","pageActivitySubscription","subscribe","data","isBusy","lastChangeTime","stop","unsubscribe","event","observable","subscriptions","firstRequestIndex","pendingRequestsCount","push","notifyPageActivity","type","RESOURCE","entries","entry","isExcludedUrl","name","REQUEST_STARTED","startEvent","url","requestIndex","REQUEST_COMPLETED","request","_trackWindowOpen","trackWindowOpen","stopTrackingWindowOpen","s","notify","requestUrl","excludedActivityUrls","callback","window"],"sources":["../../../rum/src/domain/waitPageActivityEnd.js"],"sourcesContent":["import {\n Observable,\n each,\n timeStampNow,\n LifeCycleEventType,\n some,\n matchList,\n instrumentMethod,\n setTimeout,\n clearTimeout\n} from '@cloudcare/browser-core'\nimport {\n createPerformanceObservable,\n RumPerformanceEntryType\n} from '../domain/performanceObservable'\n// Delay to wait for a page activity to validate the tracking process\nexport var PAGE_ACTIVITY_VALIDATION_DELAY = 100\n// Delay to wait after a page activity to end the tracking process\nexport var PAGE_ACTIVITY_END_DELAY = 100\n\n/**\n * Wait for the page activity end\n *\n * Detection lifecycle:\n * ```\n * Wait page activity end\n * .-------------------'--------------------.\n * v v\n * [Wait for a page activity ] [Wait for a maximum duration]\n * [timeout: VALIDATION_DELAY] [ timeout: maxDuration ]\n * / \\ |\n * v v |\n * [No page activity] [Page activity] |\n * | |,----------------------. |\n * v v | |\n * (Discard) [Wait for a page activity] | |\n * [ timeout: END_DELAY ] | |\n * / \\ | |\n * v v | |\n * [No page activity] [Page activity] | |\n * | | | |\n * | '------------' |\n * '-----------. ,--------------------'\n * v\n * (End)\n * ```\n *\n * Note: by assuming that maxDuration is greater than VALIDATION_DELAY, we are sure that if the\n * process is still alive after maxDuration, it has been validated.\n */\nexport function waitPageActivityEnd(\n lifeCycle,\n domMutationObservable,\n configuration,\n pageActivityEndCallback,\n maxDuration\n) {\n var pageActivityObservable = createPageActivityObservable(\n lifeCycle,\n domMutationObservable,\n configuration\n )\n return doWaitPageActivityEnd(\n pageActivityObservable,\n pageActivityEndCallback,\n maxDuration\n )\n}\n\nexport function doWaitPageActivityEnd(\n pageActivityObservable,\n pageActivityEndCallback,\n maxDuration\n) {\n var pageActivityEndTimeoutId\n var hasCompleted = false\n var validationTimeoutId = setTimeout(function () {\n complete({ hadActivity: false })\n }, PAGE_ACTIVITY_VALIDATION_DELAY)\n\n var maxDurationTimeoutId =\n maxDuration !== undefined\n ? setTimeout(function () {\n return complete({ hadActivity: true, end: timeStampNow() })\n }, maxDuration)\n : undefined\n\n var pageActivitySubscription = pageActivityObservable.subscribe(function (\n data\n ) {\n var isBusy = data.isBusy\n clearTimeout(validationTimeoutId)\n clearTimeout(pageActivityEndTimeoutId)\n var lastChangeTime = timeStampNow()\n if (!isBusy) {\n pageActivityEndTimeoutId = setTimeout(function () {\n complete({ hadActivity: true, end: lastChangeTime })\n }, PAGE_ACTIVITY_END_DELAY)\n }\n })\n var stop = function () {\n hasCompleted = true\n clearTimeout(validationTimeoutId)\n clearTimeout(pageActivityEndTimeoutId)\n clearTimeout(maxDurationTimeoutId)\n pageActivitySubscription.unsubscribe()\n }\n function complete(event) {\n if (hasCompleted) {\n return\n }\n stop && stop()\n pageActivityEndCallback(event)\n }\n return { stop: stop }\n}\n\nexport function createPageActivityObservable(\n lifeCycle,\n domMutationObservable,\n configuration\n) {\n return new Observable(function (observable) {\n var subscriptions = []\n var firstRequestIndex\n var pendingRequestsCount = 0\n\n subscriptions.push(\n domMutationObservable.subscribe(() => {\n notifyPageActivity()\n }),\n createPerformanceObservable(configuration, {\n type: RumPerformanceEntryType.RESOURCE\n }).subscribe(function (entries) {\n if (\n some(entries, function (entry) {\n return !isExcludedUrl(configuration, entry.name)\n })\n ) {\n notifyPageActivity()\n }\n }),\n lifeCycle.subscribe(\n LifeCycleEventType.REQUEST_STARTED,\n function (startEvent) {\n if (isExcludedUrl(configuration, startEvent.url)) {\n return\n }\n\n if (firstRequestIndex === undefined) {\n firstRequestIndex = startEvent.requestIndex\n }\n pendingRequestsCount += 1\n notifyPageActivity()\n }\n ),\n lifeCycle.subscribe(\n LifeCycleEventType.REQUEST_COMPLETED,\n function (request) {\n if (\n isExcludedUrl(configuration, request.url) ||\n firstRequestIndex === undefined ||\n // If the request started before the tracking start, ignore it\n request.requestIndex < firstRequestIndex\n ) {\n return\n }\n\n pendingRequestsCount -= 1\n notifyPageActivity()\n }\n )\n )\n\n var _trackWindowOpen = trackWindowOpen(notifyPageActivity)\n var stopTrackingWindowOpen = _trackWindowOpen.stop\n return function () {\n stopTrackingWindowOpen()\n each(subscriptions, function (s) {\n s.unsubscribe()\n })\n }\n\n function notifyPageActivity() {\n observable.notify({ isBusy: pendingRequestsCount > 0 })\n }\n })\n}\n\nfunction isExcludedUrl(configuration, requestUrl) {\n return matchList(configuration.excludedActivityUrls, requestUrl)\n}\n\nfunction trackWindowOpen(callback) {\n return instrumentMethod(window, 'open', callback)\n}\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,IAAI,EACJC,YAAY,EACZC,kBAAkB,EAClBC,IAAI,EACJC,SAAS,EACTC,gBAAgB,EAChBC,UAAU,EACVC,YAAY,QACP,yBAAyB;AAChC,SACEC,2BAA2B,EAC3BC,uBAAuB,QAClB,iCAAiC;AACxC;AACA,OAAO,IAAIC,8BAA8B,GAAG,GAAG;AAC/C;AACA,OAAO,IAAIC,uBAAuB,GAAG,GAAG;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CACjCC,SAAS,EACTC,qBAAqB,EACrBC,aAAa,EACbC,uBAAuB,EACvBC,WAAW,EACX;EACA,IAAIC,sBAAsB,GAAGC,4BAA4B,CACvDN,SAAS,EACTC,qBAAqB,EACrBC,aACF,CAAC;EACD,OAAOK,qBAAqB,CAC1BF,sBAAsB,EACtBF,uBAAuB,EACvBC,WACF,CAAC;AACH;AAEA,OAAO,SAASG,qBAAqBA,CACnCF,sBAAsB,EACtBF,uBAAuB,EACvBC,WAAW,EACX;EACA,IAAII,wBAAwB;EAC5B,IAAIC,YAAY,GAAG,KAAK;EACxB,IAAIC,mBAAmB,GAAGjB,UAAU,CAAC,YAAY;IAC/CkB,QAAQ,CAAC;MAAEC,WAAW,EAAE;IAAM,CAAC,CAAC;EAClC,CAAC,EAAEf,8BAA8B,CAAC;EAElC,IAAIgB,oBAAoB,GACtBT,WAAW,KAAKU,SAAS,GACrBrB,UAAU,CAAC,YAAY;IACrB,OAAOkB,QAAQ,CAAC;MAAEC,WAAW,EAAE,IAAI;MAAEG,GAAG,EAAE3B,YAAY,CAAC;IAAE,CAAC,CAAC;EAC7D,CAAC,EAAEgB,WAAW,CAAC,GACfU,SAAS;EAEf,IAAIE,wBAAwB,GAAGX,sBAAsB,CAACY,SAAS,CAAC,UAC9DC,IAAI,EACJ;IACA,IAAIC,MAAM,GAAGD,IAAI,CAACC,MAAM;IACxBzB,YAAY,CAACgB,mBAAmB,CAAC;IACjChB,YAAY,CAACc,wBAAwB,CAAC;IACtC,IAAIY,cAAc,GAAGhC,YAAY,CAAC,CAAC;IACnC,IAAI,CAAC+B,MAAM,EAAE;MACXX,wBAAwB,GAAGf,UAAU,CAAC,YAAY;QAChDkB,QAAQ,CAAC;UAAEC,WAAW,EAAE,IAAI;UAAEG,GAAG,EAAEK;QAAe,CAAC,CAAC;MACtD,CAAC,EAAEtB,uBAAuB,CAAC;IAC7B;EACF,CAAC,CAAC;EACF,IAAIuB,IAAI,GAAG,SAAPA,IAAIA,CAAA,EAAe;IACrBZ,YAAY,GAAG,IAAI;IACnBf,YAAY,CAACgB,mBAAmB,CAAC;IACjChB,YAAY,CAACc,wBAAwB,CAAC;IACtCd,YAAY,CAACmB,oBAAoB,CAAC;IAClCG,wBAAwB,CAACM,WAAW,CAAC,CAAC;EACxC,CAAC;EACD,SAASX,QAAQA,CAACY,KAAK,EAAE;IACvB,IAAId,YAAY,EAAE;MAChB;IACF;IACAY,IAAI,IAAIA,IAAI,CAAC,CAAC;IACdlB,uBAAuB,CAACoB,KAAK,CAAC;EAChC;EACA,OAAO;IAAEF,IAAI,EAAEA;EAAK,CAAC;AACvB;AAEA,OAAO,SAASf,4BAA4BA,CAC1CN,SAAS,EACTC,qBAAqB,EACrBC,aAAa,EACb;EACA,OAAO,IAAIhB,UAAU,CAAC,UAAUsC,UAAU,EAAE;IAC1C,IAAIC,aAAa,GAAG,EAAE;IACtB,IAAIC,iBAAiB;IACrB,IAAIC,oBAAoB,GAAG,CAAC;IAE5BF,aAAa,CAACG,IAAI,CAChB3B,qBAAqB,CAACgB,SAAS,CAAC,YAAM;MACpCY,kBAAkB,CAAC,CAAC;IACtB,CAAC,CAAC,EACFlC,2BAA2B,CAACO,aAAa,EAAE;MACzC4B,IAAI,EAAElC,uBAAuB,CAACmC;IAChC,CAAC,CAAC,CAACd,SAAS,CAAC,UAAUe,OAAO,EAAE;MAC9B,IACE1C,IAAI,CAAC0C,OAAO,EAAE,UAAUC,KAAK,EAAE;QAC7B,OAAO,CAACC,aAAa,CAAChC,aAAa,EAAE+B,KAAK,CAACE,IAAI,CAAC;MAClD,CAAC,CAAC,EACF;QACAN,kBAAkB,CAAC,CAAC;MACtB;IACF,CAAC,CAAC,EACF7B,SAAS,CAACiB,SAAS,CACjB5B,kBAAkB,CAAC+C,eAAe,EAClC,UAAUC,UAAU,EAAE;MACpB,IAAIH,aAAa,CAAChC,aAAa,EAAEmC,UAAU,CAACC,GAAG,CAAC,EAAE;QAChD;MACF;MAEA,IAAIZ,iBAAiB,KAAKZ,SAAS,EAAE;QACnCY,iBAAiB,GAAGW,UAAU,CAACE,YAAY;MAC7C;MACAZ,oBAAoB,IAAI,CAAC;MACzBE,kBAAkB,CAAC,CAAC;IACtB,CACF,CAAC,EACD7B,SAAS,CAACiB,SAAS,CACjB5B,kBAAkB,CAACmD,iBAAiB,EACpC,UAAUC,OAAO,EAAE;MACjB,IACEP,aAAa,CAAChC,aAAa,EAAEuC,OAAO,CAACH,GAAG,CAAC,IACzCZ,iBAAiB,KAAKZ,SAAS;MAC/B;MACA2B,OAAO,CAACF,YAAY,GAAGb,iBAAiB,EACxC;QACA;MACF;MAEAC,oBAAoB,IAAI,CAAC;MACzBE,kBAAkB,CAAC,CAAC;IACtB,CACF,CACF,CAAC;IAED,IAAIa,gBAAgB,GAAGC,eAAe,CAACd,kBAAkB,CAAC;IAC1D,IAAIe,sBAAsB,GAAGF,gBAAgB,CAACrB,IAAI;IAClD,OAAO,YAAY;MACjBuB,sBAAsB,CAAC,CAAC;MACxBzD,IAAI,CAACsC,aAAa,EAAE,UAAUoB,CAAC,EAAE;QAC/BA,CAAC,CAACvB,WAAW,CAAC,CAAC;MACjB,CAAC,CAAC;IACJ,CAAC;IAED,SAASO,kBAAkBA,CAAA,EAAG;MAC5BL,UAAU,CAACsB,MAAM,CAAC;QAAE3B,MAAM,EAAEQ,oBAAoB,GAAG;MAAE,CAAC,CAAC;IACzD;EACF,CAAC,CAAC;AACJ;AAEA,SAASO,aAAaA,CAAChC,aAAa,EAAE6C,UAAU,EAAE;EAChD,OAAOxD,SAAS,CAACW,aAAa,CAAC8C,oBAAoB,EAAED,UAAU,CAAC;AAClE;AAEA,SAASJ,eAAeA,CAACM,QAAQ,EAAE;EACjC,OAAOzD,gBAAgB,CAAC0D,MAAM,EAAE,MAAM,EAAED,QAAQ,CAAC;AACnD","ignoreList":[]}
|
package/esm/index.js
ADDED
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["datafluxRum"],"sources":["../src/index.js"],"sourcesContent":["import { datafluxRum } from '../../rum/src/boot/rum.slim.entry'\n\nexport { datafluxRum }\n\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,mCAAmC;AAE/D,SAASA,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LifeCycleEventType, RumEventType, startBatchWithReplica } from '@cloudcare/browser-core';
|
|
2
|
+
import { EncoderStreamId } from '../domain/encoderStreamId';
|
|
3
|
+
export function startRumBatch(configuration, lifeCycle, telemetryEventObservable, reportError, pageExitObservable, sessionExpireObservable, createEncoder) {
|
|
4
|
+
var batch = startBatchWithReplica(configuration, {
|
|
5
|
+
endpoint: configuration.rumEndpoint,
|
|
6
|
+
encoder: createEncoder(EncoderStreamId.RUM)
|
|
7
|
+
}, reportError, pageExitObservable, sessionExpireObservable);
|
|
8
|
+
lifeCycle.subscribe(LifeCycleEventType.RUM_EVENT_COLLECTED, function (serverRumEvent) {
|
|
9
|
+
if (serverRumEvent.type === RumEventType.VIEW) {
|
|
10
|
+
batch.upsert(serverRumEvent, serverRumEvent.view.id);
|
|
11
|
+
} else {
|
|
12
|
+
batch.add(serverRumEvent);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
telemetryEventObservable.subscribe(function (event) {
|
|
16
|
+
batch.add(event);
|
|
17
|
+
});
|
|
18
|
+
return batch;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=startRumBatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startRumBatch.js","names":["LifeCycleEventType","RumEventType","startBatchWithReplica","EncoderStreamId","startRumBatch","configuration","lifeCycle","telemetryEventObservable","reportError","pageExitObservable","sessionExpireObservable","createEncoder","batch","endpoint","rumEndpoint","encoder","RUM","subscribe","RUM_EVENT_COLLECTED","serverRumEvent","type","VIEW","upsert","view","id","add","event"],"sources":["../../../rum/src/transport/startRumBatch.js"],"sourcesContent":["import {\n LifeCycleEventType,\n RumEventType,\n startBatchWithReplica\n} from '@cloudcare/browser-core'\nimport { EncoderStreamId } from '../domain/encoderStreamId'\nexport function startRumBatch(\n configuration,\n lifeCycle,\n telemetryEventObservable,\n reportError,\n pageExitObservable,\n sessionExpireObservable,\n createEncoder\n) {\n const batch = startBatchWithReplica(\n configuration,\n {\n endpoint: configuration.rumEndpoint,\n encoder: createEncoder(EncoderStreamId.RUM)\n },\n reportError,\n pageExitObservable,\n sessionExpireObservable\n )\n lifeCycle.subscribe(\n LifeCycleEventType.RUM_EVENT_COLLECTED,\n function (serverRumEvent) {\n if (serverRumEvent.type === RumEventType.VIEW) {\n batch.upsert(serverRumEvent, serverRumEvent.view.id)\n } else {\n batch.add(serverRumEvent)\n }\n }\n )\n telemetryEventObservable.subscribe(function (event) {\n batch.add(event)\n })\n return batch\n}\n"],"mappings":"AAAA,SACEA,kBAAkB,EAClBC,YAAY,EACZC,qBAAqB,QAChB,yBAAyB;AAChC,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,OAAO,SAASC,aAAaA,CAC3BC,aAAa,EACbC,SAAS,EACTC,wBAAwB,EACxBC,WAAW,EACXC,kBAAkB,EAClBC,uBAAuB,EACvBC,aAAa,EACb;EACA,IAAMC,KAAK,GAAGV,qBAAqB,CACjCG,aAAa,EACb;IACEQ,QAAQ,EAAER,aAAa,CAACS,WAAW;IACnCC,OAAO,EAAEJ,aAAa,CAACR,eAAe,CAACa,GAAG;EAC5C,CAAC,EACDR,WAAW,EACXC,kBAAkB,EAClBC,uBACF,CAAC;EACDJ,SAAS,CAACW,SAAS,CACjBjB,kBAAkB,CAACkB,mBAAmB,EACtC,UAAUC,cAAc,EAAE;IACxB,IAAIA,cAAc,CAACC,IAAI,KAAKnB,YAAY,CAACoB,IAAI,EAAE;MAC7CT,KAAK,CAACU,MAAM,CAACH,cAAc,EAAEA,cAAc,CAACI,IAAI,CAACC,EAAE,CAAC;IACtD,CAAC,MAAM;MACLZ,KAAK,CAACa,GAAG,CAACN,cAAc,CAAC;IAC3B;EACF,CACF,CAAC;EACDZ,wBAAwB,CAACU,SAAS,CAAC,UAAUS,KAAK,EAAE;IAClDd,KAAK,CAACa,GAAG,CAACC,KAAK,CAAC;EAClB,CAAC,CAAC;EACF,OAAOd,KAAK;AACd","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { getEventBridge, LifeCycleEventType, processedMessageByDataMap } from '@cloudcare/browser-core';
|
|
2
|
+
export function startRumEventBridge(lifeCycle) {
|
|
3
|
+
var bridge = getEventBridge();
|
|
4
|
+
lifeCycle.subscribe(LifeCycleEventType.RUM_EVENT_COLLECTED, function (serverRumEvent) {
|
|
5
|
+
var data = processedMessageByDataMap(serverRumEvent).rowData;
|
|
6
|
+
bridge.send('rum', data);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=startRumEventBridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startRumEventBridge.js","names":["getEventBridge","LifeCycleEventType","processedMessageByDataMap","startRumEventBridge","lifeCycle","bridge","subscribe","RUM_EVENT_COLLECTED","serverRumEvent","data","rowData","send"],"sources":["../../../rum/src/transport/startRumEventBridge.js"],"sourcesContent":["import {\n getEventBridge,\n LifeCycleEventType,\n processedMessageByDataMap\n} from '@cloudcare/browser-core'\n\nexport function startRumEventBridge(lifeCycle) {\n var bridge = getEventBridge()\n\n lifeCycle.subscribe(\n LifeCycleEventType.RUM_EVENT_COLLECTED,\n function (serverRumEvent) {\n var data = processedMessageByDataMap(serverRumEvent).rowData\n bridge.send('rum', data)\n }\n )\n}\n"],"mappings":"AAAA,SACEA,cAAc,EACdC,kBAAkB,EAClBC,yBAAyB,QACpB,yBAAyB;AAEhC,OAAO,SAASC,mBAAmBA,CAACC,SAAS,EAAE;EAC7C,IAAIC,MAAM,GAAGL,cAAc,CAAC,CAAC;EAE7BI,SAAS,CAACE,SAAS,CACjBL,kBAAkB,CAACM,mBAAmB,EACtC,UAAUC,cAAc,EAAE;IACxB,IAAIC,IAAI,GAAGP,yBAAyB,CAACM,cAAc,CAAC,CAACE,OAAO;IAC5DL,MAAM,CAACM,IAAI,CAAC,KAAK,EAAEF,IAAI,CAAC;EAC1B,CACF,CAAC;AACH","ignoreList":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cloudcare/browser-rum-slim",
|
|
3
|
+
"version": "3.3.3",
|
|
4
|
+
"main": "cjs/index.js",
|
|
5
|
+
"module": "esm/index.js",
|
|
6
|
+
"types": "types/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@cloudcare/browser-core": "3.3.0"
|
|
9
|
+
},
|
|
10
|
+
"description": "Guance Browser SDK RUM Slim Package",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "webpack serve --open --mode=development",
|
|
13
|
+
"build": "run-s build:cjs build:esm build:bundle",
|
|
14
|
+
"build:cjs": "node ./scripts/build-module.js cjs",
|
|
15
|
+
"build:esm": "node ./scripts/build-module.js esm",
|
|
16
|
+
"build:bundle": "rm -rf bundle && webpack --mode=production",
|
|
17
|
+
"publish:oss:current": "npm run build:bundle && node ./scripts/publish-oss.js current",
|
|
18
|
+
"publish:oss:lts": "npm run build:bundle && node ./scripts/publish-oss.js lts",
|
|
19
|
+
"publish:oss:test": "npm run build:bundle && node ./scripts/publish-oss.js test"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"dataflux",
|
|
23
|
+
"rum",
|
|
24
|
+
"slim",
|
|
25
|
+
"sdk"
|
|
26
|
+
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"url": "https://github.com/GuanceCloud/datakit-js",
|
|
29
|
+
"type": "git",
|
|
30
|
+
"directory": "packages/rum-slim"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"author": "dataflux",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"homepage": "https://github.com/GuanceCloud/datakit-js/README.md",
|
|
38
|
+
"gitHead": "3d56fd64b8e9084c1394c901b26b2d2720db2a2e"
|
|
39
|
+
}
|