@cloudcare/browser-rum 3.1.23 → 3.1.24
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 +1 -1
- package/cjs/boot/rum.js +1 -1
- package/cjs/boot/rum.js.map +1 -1
- package/cjs/domain/firstInputPolyfill.js +83 -0
- package/cjs/domain/firstInputPolyfill.js.map +1 -0
- package/cjs/domain/performanceCollection.js +4 -90
- package/cjs/domain/performanceCollection.js.map +1 -1
- package/cjs/domain/performanceObservable.js +11 -0
- package/cjs/domain/performanceObservable.js.map +1 -1
- package/cjs/domain/performanceUtils.js +30 -2
- package/cjs/domain/performanceUtils.js.map +1 -1
- package/cjs/domain/replay/deflate/deflateWorker.js +1 -1
- package/cjs/domain/rumEventsCollection/longTask/longTaskCollection.js +10 -2
- package/cjs/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +4 -20
- package/cjs/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js +1 -1
- package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +6 -3
- package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackFirstInput.js +8 -3
- package/cjs/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js +4 -4
- package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +21 -6
- package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +6 -4
- package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js +19 -24
- package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackViews.js +1 -1
- package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/rum.js +1 -1
- package/esm/boot/rum.js.map +1 -1
- package/esm/domain/firstInputPolyfill.js +77 -0
- package/esm/domain/firstInputPolyfill.js.map +1 -0
- package/esm/domain/performanceCollection.js +4 -90
- package/esm/domain/performanceCollection.js.map +1 -1
- package/esm/domain/performanceObservable.js +11 -1
- package/esm/domain/performanceObservable.js.map +1 -1
- package/esm/domain/performanceUtils.js +29 -2
- package/esm/domain/performanceUtils.js.map +1 -1
- package/esm/domain/replay/deflate/deflateWorker.js +1 -1
- package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js +11 -3
- package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +6 -22
- package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js +1 -1
- package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +8 -5
- package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackFirstInput.js +10 -5
- package/esm/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js +4 -4
- package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +23 -8
- package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +7 -5
- package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js +21 -26
- package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackViews.js +1 -1
- package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/package.json +4 -4
- package/src/boot/rum.js +1 -1
- package/src/domain/firstInputPolyfill.js +92 -0
- package/src/domain/performanceCollection.js +5 -112
- package/src/domain/performanceObservable.js +17 -2
- package/src/domain/performanceUtils.js +37 -2
- package/src/domain/rumEventsCollection/longTask/longTaskCollection.js +37 -26
- package/src/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +6 -35
- package/src/domain/rumEventsCollection/view/trackCommonViewMetrics.js +1 -2
- package/src/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +26 -19
- package/src/domain/rumEventsCollection/view/trackFirstInput.js +40 -42
- package/src/domain/rumEventsCollection/view/trackInitialViewTimings.js +1 -4
- package/src/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +43 -35
- package/src/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +32 -32
- package/src/domain/rumEventsCollection/view/trackNavigationTimings.js +29 -31
- package/src/domain/rumEventsCollection/view/trackViews.js +1 -6
|
@@ -6,7 +6,10 @@ import {
|
|
|
6
6
|
ONE_MINUTE
|
|
7
7
|
} from '@cloudcare/browser-core'
|
|
8
8
|
import { getSelectorFromElement } from '../actions/getSelectorsFromElement'
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
RumPerformanceEntryType,
|
|
11
|
+
createPerformanceObservable
|
|
12
|
+
} from '../../performanceObservable'
|
|
10
13
|
/**
|
|
11
14
|
* Track the largest contentful paint (LCP) occurring during the initial View. This can yield
|
|
12
15
|
* multiple values, only the most recent one should be used.
|
|
@@ -16,7 +19,6 @@ import { RumPerformanceEntryType } from '../../performanceObservable'
|
|
|
16
19
|
// It happens in some cases like sleep mode or some browser implementations
|
|
17
20
|
export var LCP_MAXIMUM_DELAY = 10 * ONE_MINUTE
|
|
18
21
|
export function trackLargestContentfulPaint(
|
|
19
|
-
lifeCycle,
|
|
20
22
|
configuration,
|
|
21
23
|
firstHidden,
|
|
22
24
|
eventTarget,
|
|
@@ -36,43 +38,41 @@ export function trackLargestContentfulPaint(
|
|
|
36
38
|
)
|
|
37
39
|
var stopEventListener = _addEventListeners.stop
|
|
38
40
|
var biggestLcpSize = 0
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
var performanceLcpSubscription = createPerformanceObservable(configuration, {
|
|
42
|
+
type: RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT,
|
|
43
|
+
buffered: true
|
|
44
|
+
}).subscribe(function (entries) {
|
|
45
|
+
var lcpEntry = findLast(entries, function (entry) {
|
|
46
|
+
return (
|
|
47
|
+
entry.entryType === RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT &&
|
|
48
|
+
entry.startTime < firstInteractionTimestamp &&
|
|
49
|
+
entry.startTime < firstHidden.getTimeStamp() &&
|
|
50
|
+
entry.startTime < LCP_MAXIMUM_DELAY &&
|
|
51
|
+
// Ensure to get the LCP entry with the biggest size, see
|
|
52
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1516655
|
|
53
|
+
entry.size > biggestLcpSize
|
|
54
|
+
)
|
|
55
|
+
})
|
|
56
|
+
if (lcpEntry) {
|
|
57
|
+
var lcpTargetSelector
|
|
58
|
+
if (lcpEntry.element) {
|
|
59
|
+
lcpTargetSelector = getSelectorFromElement(
|
|
60
|
+
lcpEntry.element,
|
|
61
|
+
configuration.actionNameAttribute
|
|
52
62
|
)
|
|
53
|
-
})
|
|
54
|
-
if (lcpEntry) {
|
|
55
|
-
var lcpTargetSelector
|
|
56
|
-
if (lcpEntry.element) {
|
|
57
|
-
lcpTargetSelector = getSelectorFromElement(
|
|
58
|
-
lcpEntry.element,
|
|
59
|
-
configuration.actionNameAttribute
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
callback({
|
|
63
|
-
value: lcpEntry.startTime,
|
|
64
|
-
targetSelector: lcpTargetSelector
|
|
65
|
-
})
|
|
66
|
-
biggestLcpSize = lcpEntry.size
|
|
67
63
|
}
|
|
64
|
+
callback({
|
|
65
|
+
value: lcpEntry.startTime,
|
|
66
|
+
targetSelector: lcpTargetSelector
|
|
67
|
+
})
|
|
68
|
+
biggestLcpSize = lcpEntry.size
|
|
68
69
|
}
|
|
69
|
-
)
|
|
70
|
-
var unsubscribeLifeCycle = subscribe.unsubscribe
|
|
70
|
+
})
|
|
71
71
|
|
|
72
72
|
return {
|
|
73
73
|
stop: function () {
|
|
74
74
|
stopEventListener()
|
|
75
|
-
|
|
75
|
+
performanceLcpSubscription.unsubscribe()
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -1,37 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
relativeNow,
|
|
3
|
-
each,
|
|
4
3
|
setTimeout,
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
runOnReadyState,
|
|
5
|
+
clearTimeout
|
|
7
6
|
} from '@cloudcare/browser-core'
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
|
|
8
|
+
import { getNavigationEntry } from '../../performanceUtils'
|
|
9
|
+
export function trackNavigationTimings(
|
|
10
|
+
configuration,
|
|
11
|
+
callback,
|
|
12
|
+
getNavigationEntryImpl
|
|
13
|
+
) {
|
|
14
|
+
if (getNavigationEntryImpl === undefined) {
|
|
15
|
+
getNavigationEntryImpl = getNavigationEntry
|
|
16
|
+
}
|
|
17
|
+
return waitAfterLoadEvent(function () {
|
|
18
|
+
var entry = getNavigationEntryImpl()
|
|
19
|
+
|
|
16
20
|
if (!isIncompleteNavigation(entry)) {
|
|
17
21
|
callback(processNavigationEntry(entry))
|
|
18
22
|
}
|
|
19
|
-
}
|
|
20
|
-
var stop = noop
|
|
21
|
-
if (supportPerformanceTimingEvent(RumPerformanceEntryType.NAVIGATION)) {
|
|
22
|
-
var subscribe = createPerformanceObservable(configuration, {
|
|
23
|
-
type: RumPerformanceEntryType.NAVIGATION,
|
|
24
|
-
buffered: true
|
|
25
|
-
}).subscribe(function (entries) {
|
|
26
|
-
return each(entries, processEntry)
|
|
27
|
-
})
|
|
28
|
-
stop = subscribe.unsubscribe
|
|
29
|
-
} else {
|
|
30
|
-
retrieveNavigationTiming(configuration, processEntry)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return { stop: stop }
|
|
23
|
+
})
|
|
34
24
|
}
|
|
25
|
+
|
|
35
26
|
function processNavigationEntry(entry) {
|
|
36
27
|
return {
|
|
37
28
|
fetchStart: entry.fetchStart,
|
|
@@ -59,11 +50,18 @@ function isIncompleteNavigation(entry) {
|
|
|
59
50
|
return entry.loadEventEnd <= 0
|
|
60
51
|
}
|
|
61
52
|
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
function waitAfterLoadEvent(callback) {
|
|
54
|
+
var timeoutId
|
|
55
|
+
var _runOnReadyState = runOnReadyState('complete', function () {
|
|
56
|
+
// Invoke the callback a bit after the actual load event, so the "loadEventEnd" timing is accurate
|
|
57
|
+
timeoutId = setTimeout(function () {
|
|
58
|
+
callback()
|
|
67
59
|
})
|
|
68
60
|
})
|
|
61
|
+
return {
|
|
62
|
+
stop: function () {
|
|
63
|
+
_runOnReadyState.stop()
|
|
64
|
+
clearTimeout(timeoutId)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
69
67
|
}
|
|
@@ -192,12 +192,7 @@ function newView(
|
|
|
192
192
|
var setViewEnd = _trackCommonViewMetrics.setViewEnd
|
|
193
193
|
var _trackInitialViewTimings =
|
|
194
194
|
loadingType === ViewLoadingType.INITIAL_LOAD
|
|
195
|
-
? trackInitialViewMetrics(
|
|
196
|
-
lifeCycle,
|
|
197
|
-
configuration,
|
|
198
|
-
setLoadEvent,
|
|
199
|
-
scheduleViewUpdate
|
|
200
|
-
)
|
|
195
|
+
? trackInitialViewMetrics(configuration, setLoadEvent, scheduleViewUpdate)
|
|
201
196
|
: {
|
|
202
197
|
stop: noop,
|
|
203
198
|
initialViewMetrics: {}
|