@cloudcare/browser-rum 3.3.15 → 3.3.16
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/README.md +12 -0
- package/README.zh.md +13 -0
- package/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/boot/startRecording.js +4 -4
- package/cjs/boot/startRecording.js.map +1 -1
- package/cjs/constants.js +8 -8
- package/cjs/constants.js.map +1 -1
- package/cjs/domain/assembly.js +7 -0
- package/cjs/domain/assembly.js.map +1 -1
- package/cjs/domain/deflate/deflateWorker.js +1 -1
- package/cjs/domain/encoderStreamId.js +2 -1
- package/cjs/domain/encoderStreamId.js.map +1 -1
- package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/cjs/domain/replay/record/record.js +2 -3
- package/cjs/domain/replay/record/record.js.map +1 -1
- package/cjs/domain/replay/record/serializationUtils.js +8 -15
- package/cjs/domain/replay/record/serializationUtils.js.map +1 -1
- package/cjs/domain/replay/record/serialize.js +14 -6
- package/cjs/domain/replay/record/serialize.js.map +1 -1
- package/cjs/domain/rumEventsCollection/error/errorCollection.js +6 -8
- package/cjs/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
- package/cjs/domain/rumSessionManager.js +3 -3
- package/cjs/domain/rumSessionManager.js.map +1 -1
- package/cjs/domain/visitorId/index.js +38 -0
- package/cjs/domain/visitorId/index.js.map +1 -1
- package/cjs/index.js +7 -0
- package/cjs/index.js.map +1 -1
- package/cjs/transport/startRumBatch.js +44 -3
- package/cjs/transport/startRumBatch.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/startRecording.js +4 -4
- package/esm/boot/startRecording.js.map +1 -1
- package/esm/constants.js +1 -8
- package/esm/constants.js.map +1 -1
- package/esm/domain/assembly.js +8 -1
- package/esm/domain/assembly.js.map +1 -1
- package/esm/domain/deflate/deflateWorker.js +1 -1
- package/esm/domain/encoderStreamId.js +2 -1
- package/esm/domain/encoderStreamId.js.map +1 -1
- package/esm/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/esm/domain/replay/record/record.js +1 -2
- package/esm/domain/replay/record/record.js.map +1 -1
- package/esm/domain/replay/record/serializationUtils.js +8 -15
- package/esm/domain/replay/record/serializationUtils.js.map +1 -1
- package/esm/domain/replay/record/serialize.js +13 -5
- package/esm/domain/replay/record/serialize.js.map +1 -1
- package/esm/domain/rumEventsCollection/error/errorCollection.js +6 -8
- package/esm/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
- package/esm/domain/rumSessionManager.js +3 -3
- package/esm/domain/rumSessionManager.js.map +1 -1
- package/esm/domain/visitorId/index.js +39 -1
- package/esm/domain/visitorId/index.js.map +1 -1
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/transport/startRumBatch.js +45 -4
- package/esm/transport/startRumBatch.js.map +1 -1
- package/package.json +4 -4
- package/src/boot/startRecording.js +7 -3
- package/src/constants.js +1 -8
- package/src/domain/assembly.js +15 -1
- package/src/domain/encoderStreamId.js +2 -2
- package/src/domain/replay/record/record.js +1 -2
- package/src/domain/replay/record/serializationUtils.js +10 -24
- package/src/domain/replay/record/serialize.js +25 -5
- package/src/domain/rumEventsCollection/error/errorCollection.js +10 -8
- package/src/domain/rumSessionManager.js +8 -7
- package/src/domain/visitorId/index.js +49 -0
- package/src/index.js +1 -0
- package/src/transport/startRumBatch.js +61 -3
- package/types/index.d.ts +22 -2
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createIdentityEncoder,
|
|
3
|
+
createHttpRequest,
|
|
3
4
|
LifeCycleEventType,
|
|
5
|
+
Observable,
|
|
4
6
|
RumEventType,
|
|
5
7
|
startBatchWithReplica
|
|
6
8
|
} from '@cloudcare/browser-core'
|
|
@@ -15,10 +17,21 @@ export function startRumBatch(
|
|
|
15
17
|
createEncoder
|
|
16
18
|
) {
|
|
17
19
|
const rumEncoder = createEncoder(EncoderStreamId.RUM)
|
|
20
|
+
// Both batches share the same retry queue and bandwidth limits.
|
|
21
|
+
const request = createHttpRequest(
|
|
22
|
+
configuration.rumEndpoint,
|
|
23
|
+
configuration.batchBytesLimit,
|
|
24
|
+
configuration.retryMaxSize,
|
|
25
|
+
reportError
|
|
26
|
+
)
|
|
27
|
+
const flushRequestObservable = new Observable()
|
|
28
|
+
let initialViewBatch
|
|
29
|
+
let initialViewEncoder
|
|
18
30
|
const batch = startBatchWithReplica(
|
|
19
31
|
configuration,
|
|
20
32
|
{
|
|
21
33
|
endpoint: configuration.rumEndpoint,
|
|
34
|
+
request,
|
|
22
35
|
encoder: rumEncoder,
|
|
23
36
|
encoderFallback: rumEncoder.isAsync
|
|
24
37
|
? createIdentityEncoder
|
|
@@ -28,7 +41,7 @@ export function startRumBatch(
|
|
|
28
41
|
pageExitObservable,
|
|
29
42
|
sessionExpireObservable
|
|
30
43
|
)
|
|
31
|
-
lifeCycle.subscribe(
|
|
44
|
+
const rumEventSubscription = lifeCycle.subscribe(
|
|
32
45
|
LifeCycleEventType.RUM_EVENT_COLLECTED,
|
|
33
46
|
function (serverRumEvent) {
|
|
34
47
|
if (serverRumEvent.type === RumEventType.VIEW) {
|
|
@@ -38,8 +51,53 @@ export function startRumBatch(
|
|
|
38
51
|
}
|
|
39
52
|
}
|
|
40
53
|
)
|
|
41
|
-
|
|
54
|
+
const initialViewSubscription = lifeCycle.subscribe(
|
|
55
|
+
LifeCycleEventType.RUM_VIEW_FIRST_COLLECTED,
|
|
56
|
+
function (event) {
|
|
57
|
+
if (!initialViewBatch) {
|
|
58
|
+
initialViewEncoder = createEncoder(EncoderStreamId.RUM_INITIAL_VIEW)
|
|
59
|
+
initialViewBatch = startBatchWithReplica(
|
|
60
|
+
configuration,
|
|
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
|
+
)
|
|
83
|
+
const telemetrySubscription = telemetryEventObservable.subscribe(function (event) {
|
|
42
84
|
batch.add(event)
|
|
43
85
|
})
|
|
44
|
-
return
|
|
86
|
+
return {
|
|
87
|
+
flushObservable: batch.flushObservable,
|
|
88
|
+
add: batch.add,
|
|
89
|
+
upsert: batch.upsert,
|
|
90
|
+
stop: function () {
|
|
91
|
+
rumEventSubscription.unsubscribe()
|
|
92
|
+
initialViewSubscription.unsubscribe()
|
|
93
|
+
telemetrySubscription.unsubscribe()
|
|
94
|
+
batch.stop()
|
|
95
|
+
if (initialViewBatch) {
|
|
96
|
+
initialViewBatch.stop()
|
|
97
|
+
if (initialViewEncoder.stop) {
|
|
98
|
+
initialViewEncoder.stop()
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
45
103
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
RumInitConfiguration,
|
|
3
|
+
RumLegacyInitConfiguration,
|
|
3
4
|
RumSiteInitConfiguration,
|
|
4
5
|
Context,
|
|
5
6
|
User
|
|
6
7
|
} from '@cloudcare/browser-core'
|
|
8
|
+
export { TraceType } from '@cloudcare/browser-core'
|
|
9
|
+
export type {
|
|
10
|
+
Context,
|
|
11
|
+
User,
|
|
12
|
+
RumInitConfiguration,
|
|
13
|
+
RumLegacyInitConfiguration,
|
|
14
|
+
RumSiteInitConfiguration,
|
|
15
|
+
MatchOption,
|
|
16
|
+
OriginMatchOption,
|
|
17
|
+
TraceTypeValue,
|
|
18
|
+
TracingOption
|
|
19
|
+
} from '@cloudcare/browser-core'
|
|
7
20
|
export interface InternalContext {
|
|
8
21
|
application: {
|
|
9
22
|
id: string
|
|
@@ -39,7 +52,8 @@ export interface StartSessionOptions {
|
|
|
39
52
|
export interface StartSessionReplayRecordingOptions {
|
|
40
53
|
/**
|
|
41
54
|
* Forces the current session to be tracked, assigns a session ID when
|
|
42
|
-
* necessary, and enables Session Replay recording.
|
|
55
|
+
* necessary, and enables Session Replay recording without waiting for an error.
|
|
56
|
+
* An existing error-only replay buffer is also released.
|
|
43
57
|
*/
|
|
44
58
|
force?: boolean
|
|
45
59
|
}
|
|
@@ -227,6 +241,7 @@ export interface RumPlugin {
|
|
|
227
241
|
|
|
228
242
|
export type RumPluginInitConfiguration = (
|
|
229
243
|
| RumInitConfiguration
|
|
244
|
+
| RumLegacyInitConfiguration
|
|
230
245
|
| RumSiteInitConfiguration
|
|
231
246
|
) & {
|
|
232
247
|
plugins?: RumPlugin[] | undefined
|
|
@@ -246,7 +261,7 @@ export declare const datafluxRum: {
|
|
|
246
261
|
getGlobalContext: () => Context
|
|
247
262
|
setGlobalContext: (context: any) => void
|
|
248
263
|
clearGlobalContext: () => void
|
|
249
|
-
/** Rotates the
|
|
264
|
+
/** Rotates the Web-generated Visitor ID immediately. No-op while an allowed native bridge provides a valid Visitor ID; the App owns its rotation. */
|
|
250
265
|
resetVisitorId: () => void
|
|
251
266
|
getInternalContext: (
|
|
252
267
|
startTime?: number | undefined
|
|
@@ -273,6 +288,11 @@ export declare const datafluxRum: {
|
|
|
273
288
|
clearUser: () => void
|
|
274
289
|
stopSession: () => void
|
|
275
290
|
startSession: (options?: StartSessionOptions) => void
|
|
291
|
+
/**
|
|
292
|
+
* Forces the current session to be tracked without waiting for an error.
|
|
293
|
+
* Assigns an ID if needed and releases any existing error-only replay buffer.
|
|
294
|
+
* To start recording, call startSessionReplayRecording({ force: true }).
|
|
295
|
+
*/
|
|
276
296
|
setForcedSession: () => void
|
|
277
297
|
startSessionReplayRecording: (
|
|
278
298
|
options?: StartSessionReplayRecordingOptions
|