@cloudcare/browser-rum 3.3.18 → 3.3.20
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/domain/assembly.js +10 -3
- package/cjs/domain/assembly.js.map +1 -1
- package/cjs/domain/deflate/deflateWorker.js +1 -1
- package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/cjs/domain/rumEventsCollection/view/trackViews.js +10 -1
- package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/viewCollection.js +1 -0
- package/cjs/domain/rumEventsCollection/view/viewCollection.js.map +1 -1
- package/cjs/domain/rumSessionManager.js +3 -0
- package/cjs/domain/rumSessionManager.js.map +1 -1
- package/cjs/transport/startRumBatch.js +22 -15
- package/cjs/transport/startRumBatch.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/domain/assembly.js +10 -3
- package/esm/domain/assembly.js.map +1 -1
- package/esm/domain/deflate/deflateWorker.js +1 -1
- package/esm/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/esm/domain/rumEventsCollection/view/trackViews.js +10 -1
- package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/viewCollection.js +1 -0
- package/esm/domain/rumEventsCollection/view/viewCollection.js.map +1 -1
- package/esm/domain/rumSessionManager.js +3 -0
- package/esm/domain/rumSessionManager.js.map +1 -1
- package/esm/transport/startRumBatch.js +22 -15
- package/esm/transport/startRumBatch.js.map +1 -1
- package/package.json +4 -4
- package/src/domain/assembly.js +16 -9
- package/src/domain/rumEventsCollection/view/trackViews.js +11 -1
- package/src/domain/rumEventsCollection/view/viewCollection.js +1 -0
- package/src/domain/rumSessionManager.js +3 -0
- package/src/transport/startRumBatch.js +38 -32
- package/types/index.d.ts +3 -0
|
@@ -121,6 +121,7 @@ export function trackViews(
|
|
|
121
121
|
}
|
|
122
122
|
)
|
|
123
123
|
var stopWebViewLifecycleTracking = noop
|
|
124
|
+
var forcedSessionSubscription
|
|
124
125
|
startViewLifeCycle()
|
|
125
126
|
var pendingNavigation
|
|
126
127
|
var locationChangeSubscription = renewViewOnLocationChange(
|
|
@@ -140,6 +141,12 @@ export function trackViews(
|
|
|
140
141
|
currentView.stop()
|
|
141
142
|
}
|
|
142
143
|
lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, renewCurrentView)
|
|
144
|
+
forcedSessionSubscription = lifeCycle.subscribe(
|
|
145
|
+
LifeCycleEventType.SESSION_FORCED,
|
|
146
|
+
function () {
|
|
147
|
+
currentView.update({ isForcedSessionUpdate: true })
|
|
148
|
+
}
|
|
149
|
+
)
|
|
143
150
|
|
|
144
151
|
lifeCycle.subscribe(
|
|
145
152
|
LifeCycleEventType.SESSION_EXPIRED,
|
|
@@ -238,6 +245,7 @@ export function trackViews(
|
|
|
238
245
|
locationChangeSubscription.unsubscribe()
|
|
239
246
|
}
|
|
240
247
|
stopWebViewLifecycleTracking()
|
|
248
|
+
forcedSessionSubscription.unsubscribe()
|
|
241
249
|
softNavigationMetricsTracking()
|
|
242
250
|
currentView.end()
|
|
243
251
|
activeViews.forEach(function (view) {
|
|
@@ -414,13 +422,14 @@ function newView(
|
|
|
414
422
|
throttled()
|
|
415
423
|
}
|
|
416
424
|
|
|
417
|
-
function triggerViewUpdate() {
|
|
425
|
+
function triggerViewUpdate(options) {
|
|
418
426
|
cancelScheduleViewUpdate()
|
|
419
427
|
triggerBeforeViewUpdate()
|
|
420
428
|
documentVersion += 1
|
|
421
429
|
var currentEnd =
|
|
422
430
|
endClocks === undefined ? timeStampNow() : endClocks.timeStamp
|
|
423
431
|
lifeCycle.notify(LifeCycleEventType.VIEW_UPDATED, {
|
|
432
|
+
isForcedSessionUpdate: Boolean(options && options.isForcedSessionUpdate),
|
|
424
433
|
customTimings: customTimings,
|
|
425
434
|
documentVersion: documentVersion,
|
|
426
435
|
id: id,
|
|
@@ -444,6 +453,7 @@ function newView(
|
|
|
444
453
|
})
|
|
445
454
|
}
|
|
446
455
|
var result = {
|
|
456
|
+
update: triggerViewUpdate,
|
|
447
457
|
name: name,
|
|
448
458
|
service: service,
|
|
449
459
|
version: version,
|
|
@@ -64,6 +64,9 @@ export function startRumSessionManager(configuration, lifeCycle) {
|
|
|
64
64
|
if (sessionEntity) {
|
|
65
65
|
sessionEntity.id = newState.id
|
|
66
66
|
sessionEntity.isSessionForced = true
|
|
67
|
+
// Publish only after the current history entry becomes collectable.
|
|
68
|
+
// Renewed sessions already create and publish their own View.
|
|
69
|
+
lifeCycle.notify(LifeCycleEventType.SESSION_FORCED)
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
}
|
|
@@ -25,8 +25,8 @@ export function startRumBatch(
|
|
|
25
25
|
reportError
|
|
26
26
|
)
|
|
27
27
|
const flushRequestObservable = new Observable()
|
|
28
|
-
let
|
|
29
|
-
let
|
|
28
|
+
let immediateViewBatch
|
|
29
|
+
let immediateViewEncoder
|
|
30
30
|
const batch = startBatchWithReplica(
|
|
31
31
|
configuration,
|
|
32
32
|
{
|
|
@@ -51,34 +51,39 @@ export function startRumBatch(
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
)
|
|
54
|
+
function sendImmediateView(event, reason) {
|
|
55
|
+
if (!immediateViewBatch) {
|
|
56
|
+
immediateViewEncoder = createEncoder(EncoderStreamId.RUM_INITIAL_VIEW)
|
|
57
|
+
immediateViewBatch = startBatchWithReplica(
|
|
58
|
+
configuration,
|
|
59
|
+
{
|
|
60
|
+
request,
|
|
61
|
+
encoder: immediateViewEncoder,
|
|
62
|
+
encoderFallback: immediateViewEncoder.isAsync
|
|
63
|
+
? createIdentityEncoder
|
|
64
|
+
: undefined,
|
|
65
|
+
flushRequestObservable
|
|
66
|
+
},
|
|
67
|
+
reportError,
|
|
68
|
+
// The regular batch already owns the exit copy. Do not promote an
|
|
69
|
+
// older first version from this encoder's journal on the same exit.
|
|
70
|
+
new Observable(),
|
|
71
|
+
sessionExpireObservable
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
// Send initial and forced-session Views separately. The normal batch retains
|
|
75
|
+
// each View's latest version for its original deadline and exit beacon,
|
|
76
|
+
// including rapid routes whose first fetches have not completed yet.
|
|
77
|
+
immediateViewBatch.upsert(event, event.view.id)
|
|
78
|
+
flushRequestObservable.notify(reason)
|
|
79
|
+
}
|
|
54
80
|
const initialViewSubscription = lifeCycle.subscribe(
|
|
55
81
|
LifeCycleEventType.RUM_VIEW_FIRST_COLLECTED,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
request,
|
|
63
|
-
encoder: initialViewEncoder,
|
|
64
|
-
encoderFallback: initialViewEncoder.isAsync
|
|
65
|
-
? createIdentityEncoder
|
|
66
|
-
: undefined,
|
|
67
|
-
flushRequestObservable
|
|
68
|
-
},
|
|
69
|
-
reportError,
|
|
70
|
-
// The regular batch already owns the exit copy. Do not promote an
|
|
71
|
-
// older first version from this encoder's journal on the same exit.
|
|
72
|
-
new Observable(),
|
|
73
|
-
sessionExpireObservable
|
|
74
|
-
)
|
|
75
|
-
}
|
|
76
|
-
// Send the first eligible version separately. The normal batch retains
|
|
77
|
-
// each View's latest version for its original deadline and exit beacon,
|
|
78
|
-
// including rapid routes whose first fetches have not completed yet.
|
|
79
|
-
initialViewBatch.upsert(event, event.view.id)
|
|
80
|
-
flushRequestObservable.notify('view_created')
|
|
81
|
-
}
|
|
82
|
+
event => sendImmediateView(event, 'view_created')
|
|
83
|
+
)
|
|
84
|
+
const forcedViewSubscription = lifeCycle.subscribe(
|
|
85
|
+
LifeCycleEventType.RUM_VIEW_FORCED_COLLECTED,
|
|
86
|
+
event => sendImmediateView(event, 'session_forced')
|
|
82
87
|
)
|
|
83
88
|
const telemetrySubscription = telemetryEventObservable.subscribe(function (event) {
|
|
84
89
|
batch.add(event)
|
|
@@ -90,12 +95,13 @@ export function startRumBatch(
|
|
|
90
95
|
stop: function () {
|
|
91
96
|
rumEventSubscription.unsubscribe()
|
|
92
97
|
initialViewSubscription.unsubscribe()
|
|
98
|
+
forcedViewSubscription.unsubscribe()
|
|
93
99
|
telemetrySubscription.unsubscribe()
|
|
94
100
|
batch.stop()
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
|
|
101
|
+
if (immediateViewBatch) {
|
|
102
|
+
immediateViewBatch.stop()
|
|
103
|
+
if (immediateViewEncoder.stop) {
|
|
104
|
+
immediateViewEncoder.stop()
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
107
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -296,6 +296,9 @@ export declare const datafluxRum: {
|
|
|
296
296
|
/**
|
|
297
297
|
* Forces the current session to be tracked without waiting for an error.
|
|
298
298
|
* Assigns an ID if needed and releases any existing error-only replay buffer.
|
|
299
|
+
* When the session becomes forced, immediately sends the current view with the
|
|
300
|
+
* latest user and context, even if the view was already tracked and sent.
|
|
301
|
+
* Preserves its view ID. Repeated calls on an already forced session do not resend it.
|
|
299
302
|
* To start recording, call startSessionReplayRecording({ force: true }).
|
|
300
303
|
*/
|
|
301
304
|
setForcedSession: () => void
|