@cloudcare/browser-rum 3.3.16 → 3.3.17
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/deflate/deflateWorker.js +1 -1
- package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/cjs/domain/replay/record/record.js +18 -10
- package/cjs/domain/replay/record/record.js.map +1 -1
- package/cjs/domain/replay/record/serialize.js +5 -8
- package/cjs/domain/replay/record/serialize.js.map +1 -1
- package/cjs/domain/replay/segmentCollection/segment.js +14 -10
- package/cjs/domain/replay/segmentCollection/segment.js.map +1 -1
- package/cjs/domain/replay/segmentCollection/segmentCollection.js +9 -8
- package/cjs/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/domain/deflate/deflateWorker.js +1 -1
- package/esm/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/esm/domain/replay/record/record.js +19 -11
- package/esm/domain/replay/record/record.js.map +1 -1
- package/esm/domain/replay/record/serialize.js +4 -7
- package/esm/domain/replay/record/serialize.js.map +1 -1
- package/esm/domain/replay/segmentCollection/segment.js +14 -10
- package/esm/domain/replay/segmentCollection/segment.js.map +1 -1
- package/esm/domain/replay/segmentCollection/segmentCollection.js +9 -8
- package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
- package/package.json +4 -4
- package/src/domain/replay/record/record.js +21 -18
- package/src/domain/replay/record/serialize.js +4 -14
- package/src/domain/replay/segmentCollection/segment.js +16 -9
- package/src/domain/replay/segmentCollection/segmentCollection.js +18 -14
|
@@ -28,8 +28,7 @@ import {
|
|
|
28
28
|
SerializationContextStatus,
|
|
29
29
|
getSerializedNodeApproxBytes,
|
|
30
30
|
SERIALIZATION_MAX_NODE_COUNT,
|
|
31
|
-
SERIALIZATION_MAX_APPROX_BYTES
|
|
32
|
-
FULL_SNAPSHOT_SERIALIZATION_MAX_APPROX_BYTES,
|
|
31
|
+
SERIALIZATION_MAX_APPROX_BYTES
|
|
33
32
|
} from './serialize'
|
|
34
33
|
import { initInputObserver, initObservers } from './observers'
|
|
35
34
|
|
|
@@ -1958,10 +1957,11 @@ export function record(options) {
|
|
|
1958
1957
|
serializerTask.processedNodeCount + SERIALIZATION_MAX_NODE_COUNT,
|
|
1959
1958
|
FULL_SNAPSHOT_SERIALIZATION_MAX_NODE_COUNT
|
|
1960
1959
|
)
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1960
|
+
// The byte watermark yields traversal work; it must not reject an entire
|
|
1961
|
+
// baseline just because its DOM and complete CSS exceed the encoder's
|
|
1962
|
+
// backlog watermark. Keep advancing until the snapshot is complete.
|
|
1963
|
+
var maxApproxBytes =
|
|
1964
|
+
serializerTask.approxBytes + SERIALIZATION_MAX_APPROX_BYTES
|
|
1965
1965
|
var completed = serializerTask.advance(
|
|
1966
1966
|
deadline,
|
|
1967
1967
|
maxNodeCount,
|
|
@@ -1974,10 +1974,7 @@ export function record(options) {
|
|
|
1974
1974
|
(serializerTask.isMaxDepthReached ||
|
|
1975
1975
|
serializerTask.isMaxNodeComplexityReached ||
|
|
1976
1976
|
(serializerTask.isMaxNodeCountReached &&
|
|
1977
|
-
maxNodeCount >= FULL_SNAPSHOT_SERIALIZATION_MAX_NODE_COUNT)
|
|
1978
|
-
(serializerTask.isMaxApproxBytesReached &&
|
|
1979
|
-
maxApproxBytes >=
|
|
1980
|
-
FULL_SNAPSHOT_SERIALIZATION_MAX_APPROX_BYTES))
|
|
1977
|
+
maxNodeCount >= FULL_SNAPSHOT_SERIALIZATION_MAX_NODE_COUNT))
|
|
1981
1978
|
}
|
|
1982
1979
|
}
|
|
1983
1980
|
|
|
@@ -2021,7 +2018,6 @@ export function record(options) {
|
|
|
2021
2018
|
// result from an earlier record: only the segment/encoder result for this
|
|
2022
2019
|
// exact baseline may classify its rejection as transient backpressure.
|
|
2023
2020
|
lastEmitWasLocallyBackpressured = false
|
|
2024
|
-
var timestamp = baselineRecords[0].timestamp
|
|
2025
2021
|
var fullSnapshotAccepted
|
|
2026
2022
|
if (rawEmitBaseline) {
|
|
2027
2023
|
fullSnapshotAccepted = rawEmitBaseline(baselineRecords) !== false
|
|
@@ -2037,13 +2033,6 @@ export function record(options) {
|
|
|
2037
2033
|
fullSnapshotWasPublished = true
|
|
2038
2034
|
currentFullSnapshotPublicationToken.$rPublished = true
|
|
2039
2035
|
|
|
2040
|
-
if (window.visualViewport) {
|
|
2041
|
-
rawEmit({
|
|
2042
|
-
data: getVisualViewport(),
|
|
2043
|
-
type: RecordType.VisualViewport,
|
|
2044
|
-
timestamp: timestamp
|
|
2045
|
-
})
|
|
2046
|
-
}
|
|
2047
2036
|
if (__BUILD_ENV__REPLAY_DEBUG_ENABLED__) {
|
|
2048
2037
|
updateReplayPerformanceStats({
|
|
2049
2038
|
fullSnapshotCount: 1,
|
|
@@ -2053,6 +2042,18 @@ export function record(options) {
|
|
|
2053
2042
|
return true
|
|
2054
2043
|
}
|
|
2055
2044
|
|
|
2045
|
+
function emitFullSnapshotViewport(timestamp) {
|
|
2046
|
+
if (window.visualViewport) {
|
|
2047
|
+
// Call after leaving the previous replay tree so encoder backpressure
|
|
2048
|
+
// retains this record on the new baseline's normal retry queue.
|
|
2049
|
+
emit({
|
|
2050
|
+
data: getVisualViewport(),
|
|
2051
|
+
type: RecordType.VisualViewport,
|
|
2052
|
+
timestamp: timestamp
|
|
2053
|
+
})
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2056
2057
|
function invalidateFullSnapshotCanvasBaseline() {
|
|
2057
2058
|
fullSnapshotCanvasBaselineGeneration += 1
|
|
2058
2059
|
}
|
|
@@ -2230,6 +2231,7 @@ export function record(options) {
|
|
|
2230
2231
|
serializerTask.serializedNode
|
|
2231
2232
|
)
|
|
2232
2233
|
if (emitFullSnapshot(baselineRecords, fullSnapshotStartedAt)) {
|
|
2234
|
+
emitFullSnapshotViewport(timestamp)
|
|
2233
2235
|
return { status: 'completed' }
|
|
2234
2236
|
}
|
|
2235
2237
|
if (wasLastEmitBackpressured()) {
|
|
@@ -3312,6 +3314,7 @@ export function record(options) {
|
|
|
3312
3314
|
resetPreviousReplayTreeRecords()
|
|
3313
3315
|
previousReplayTreeAdmissionActive = false
|
|
3314
3316
|
captureRecordsAgainstPreviousReplayTree = false
|
|
3317
|
+
emitFullSnapshotViewport(baselineRecords[0].timestamp)
|
|
3315
3318
|
flushDeferredRecords()
|
|
3316
3319
|
if (!suppressRecordsUntilFullSnapshot && !recordStopped) {
|
|
3317
3320
|
takeFullSnapshotCanvasBaseline()
|
|
@@ -60,13 +60,9 @@ export var SERIALIZATION_MAX_ATTRIBUTE_COUNT = 1000
|
|
|
60
60
|
export var SERIALIZATION_MAX_NODE_SOURCE_LENGTH = 200000
|
|
61
61
|
export var SERIALIZATION_MAX_MUTATION_SOURCE_LENGTH = 64 * 1024
|
|
62
62
|
export var SERIALIZATION_TRUNCATION_MARK = '…'
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
// well below the segment collection's 4 MiB backlog watermark.
|
|
63
|
+
// Bound each traversal slice. A complete snapshot may span multiple slices;
|
|
64
|
+
// this is not a size limit for the resulting DOM and CSS record.
|
|
66
65
|
export var SERIALIZATION_MAX_APPROX_BYTES = 1024 * 1024
|
|
67
|
-
// Reserve segment metadata below the existing 4 MiB pending-raw budget.
|
|
68
|
-
export var FULL_SNAPSHOT_SERIALIZATION_MAX_APPROX_BYTES =
|
|
69
|
-
SERIALIZATION_MAX_APPROX_BYTES * 4 - 64 * 1024
|
|
70
66
|
var serializedNodeApproxBytes = new WeakMap()
|
|
71
67
|
|
|
72
68
|
export function serializeDocument(
|
|
@@ -955,10 +951,7 @@ function getAttributesForPrivacyLevel(element, nodePrivacyLevel, options) {
|
|
|
955
951
|
doc,
|
|
956
952
|
element.href
|
|
957
953
|
)
|
|
958
|
-
var cssText = getCssRulesString(
|
|
959
|
-
stylesheet,
|
|
960
|
-
FULL_SNAPSHOT_SERIALIZATION_MAX_APPROX_BYTES / 2
|
|
961
|
-
)
|
|
954
|
+
var cssText = getCssRulesString(stylesheet)
|
|
962
955
|
if (cssText && stylesheet) {
|
|
963
956
|
safeAttrs._cssText = cssText
|
|
964
957
|
}
|
|
@@ -966,10 +959,7 @@ function getAttributesForPrivacyLevel(element, nodePrivacyLevel, options) {
|
|
|
966
959
|
|
|
967
960
|
// dynamic stylesheet
|
|
968
961
|
if (tagName === 'style' && element.sheet) {
|
|
969
|
-
var cssText = getCssRulesString(
|
|
970
|
-
element.sheet,
|
|
971
|
-
FULL_SNAPSHOT_SERIALIZATION_MAX_APPROX_BYTES / 2
|
|
972
|
-
)
|
|
962
|
+
var cssText = getCssRulesString(element.sheet)
|
|
973
963
|
if (cssText) {
|
|
974
964
|
safeAttrs._cssText = cssText
|
|
975
965
|
}
|
|
@@ -38,10 +38,11 @@ export function createSegment(options) {
|
|
|
38
38
|
previouslySerializedRecordData
|
|
39
39
|
) {
|
|
40
40
|
const prefix = metadata.records_count === 0 ? '{"records":[' : ','
|
|
41
|
+
const isFullSnapshot = record.type === RecordType.FullSnapshot
|
|
41
42
|
var preflightResult = preflightRecordSerialization(
|
|
42
43
|
record,
|
|
43
44
|
prefix,
|
|
44
|
-
pendingRawBytesLimit
|
|
45
|
+
isFullSnapshot ? undefined : pendingRawBytesLimit
|
|
45
46
|
)
|
|
46
47
|
if (preflightResult) {
|
|
47
48
|
return preflightResult
|
|
@@ -80,6 +81,7 @@ export function createSegment(options) {
|
|
|
80
81
|
|
|
81
82
|
if (
|
|
82
83
|
pendingRawBytesLimit !== undefined &&
|
|
84
|
+
!isFullSnapshot &&
|
|
83
85
|
rawRecordBytesCount > pendingRawBytesLimit
|
|
84
86
|
) {
|
|
85
87
|
return {
|
|
@@ -122,7 +124,9 @@ export function createSegment(options) {
|
|
|
122
124
|
: 0
|
|
123
125
|
if (
|
|
124
126
|
pendingRawBytesLimit !== undefined &&
|
|
125
|
-
|
|
127
|
+
(isFullSnapshot
|
|
128
|
+
? pendingRawBytesCount >= pendingRawBytesLimit
|
|
129
|
+
: pendingRawBytesCount + rawRecordBytesCount > pendingRawBytesLimit)
|
|
126
130
|
) {
|
|
127
131
|
return {
|
|
128
132
|
status: 'encoder_backpressure',
|
|
@@ -218,23 +222,26 @@ function preflightFullSnapshotAdmission(
|
|
|
218
222
|
if (!record || record.type !== RecordType.FullSnapshot) {
|
|
219
223
|
return
|
|
220
224
|
}
|
|
221
|
-
var knownApproxBytes = getKnownReplayRecordApproxBytes(record)
|
|
222
|
-
if (typeof knownApproxBytes !== 'number') {
|
|
223
|
-
return
|
|
224
|
-
}
|
|
225
|
-
var approximateRawBytes = prefix.length * 2 + knownApproxBytes
|
|
226
225
|
var pendingRawBytesCount = encoder.getPendingRawBytesCount
|
|
227
226
|
? encoder.getPendingRawBytesCount()
|
|
228
227
|
: 0
|
|
229
228
|
if (
|
|
230
229
|
pendingRawBytesLimit !== undefined &&
|
|
231
|
-
pendingRawBytesCount
|
|
230
|
+
pendingRawBytesCount >= pendingRawBytesLimit
|
|
232
231
|
) {
|
|
233
232
|
return {
|
|
234
233
|
status: 'encoder_backpressure',
|
|
235
|
-
estimatedBytesCount:
|
|
234
|
+
estimatedBytesCount: pendingRawBytesCount
|
|
236
235
|
}
|
|
237
236
|
}
|
|
237
|
+
// Like Datadog, admit a complete FullSnapshot into the asynchronous encoder.
|
|
238
|
+
// The watermark limits existing backlog, not the size of one atomic record.
|
|
239
|
+
// If that write exceeds the watermark, later admissions wait for it to drain.
|
|
240
|
+
var knownApproxBytes = getKnownReplayRecordApproxBytes(record)
|
|
241
|
+
if (typeof knownApproxBytes !== 'number') {
|
|
242
|
+
return
|
|
243
|
+
}
|
|
244
|
+
var approximateRawBytes = prefix.length * 2 + knownApproxBytes
|
|
238
245
|
if (
|
|
239
246
|
bytesLimit !== undefined &&
|
|
240
247
|
recordsCount > 0 &&
|
|
@@ -452,7 +452,10 @@ export function doStartSegmentCollection(
|
|
|
452
452
|
unloadingDeliveryBytesRemaining - deliveryResult.$rBytesCount,
|
|
453
453
|
0
|
|
454
454
|
)
|
|
455
|
-
if (
|
|
455
|
+
if (
|
|
456
|
+
deliveryResult.$rAllPayloadsSent === false &&
|
|
457
|
+
!deliveryResult.$rPending
|
|
458
|
+
) {
|
|
456
459
|
// Replay segments are ordered. If an older queued payload does not fit,
|
|
457
460
|
// no current tail may overtake it.
|
|
458
461
|
unloadingDeliveryBudgetExhausted = true
|
|
@@ -518,10 +521,7 @@ export function doStartSegmentCollection(
|
|
|
518
521
|
encoderResult.outputBytesCount +
|
|
519
522
|
SEGMENT_FORM_DATA_ESTIMATED_OVERHEAD
|
|
520
523
|
if (shouldUseExitTransport && unloadingTransportLatched) {
|
|
521
|
-
if (
|
|
522
|
-
unloadingDeliveryBudgetExhausted ||
|
|
523
|
-
estimatedDeliveryBytesCount > unloadingDeliveryBytesRemaining
|
|
524
|
-
) {
|
|
524
|
+
if (unloadingDeliveryBudgetExhausted) {
|
|
525
525
|
unloadingDeliveryBudgetExhausted = true
|
|
526
526
|
reportDroppedRecord(
|
|
527
527
|
'page_exit_delivery_budget',
|
|
@@ -573,7 +573,10 @@ export function doStartSegmentCollection(
|
|
|
573
573
|
exitDeliveryResult.$rBytesCount,
|
|
574
574
|
0
|
|
575
575
|
)
|
|
576
|
-
if (
|
|
576
|
+
if (
|
|
577
|
+
!exitDeliveryResult.$rCurrentPayloadSent &&
|
|
578
|
+
!exitDeliveryResult.$rPending
|
|
579
|
+
) {
|
|
577
580
|
unloadingDeliveryBudgetExhausted = true
|
|
578
581
|
reportDroppedRecord(
|
|
579
582
|
'page_exit_delivery_budget',
|
|
@@ -583,7 +586,10 @@ export function doStartSegmentCollection(
|
|
|
583
586
|
} else {
|
|
584
587
|
// Preserve compatibility with injected transports that predate the
|
|
585
588
|
// aggregate-budget result contract.
|
|
586
|
-
unloadingDeliveryBytesRemaining
|
|
589
|
+
unloadingDeliveryBytesRemaining = Math.max(
|
|
590
|
+
unloadingDeliveryBytesRemaining - estimatedDeliveryBytesCount,
|
|
591
|
+
0
|
|
592
|
+
)
|
|
587
593
|
}
|
|
588
594
|
}
|
|
589
595
|
} else {
|
|
@@ -1356,13 +1362,11 @@ export function doStartSegmentCollection(
|
|
|
1356
1362
|
} else {
|
|
1357
1363
|
flushSegment('encoder_backpressure')
|
|
1358
1364
|
}
|
|
1359
|
-
//
|
|
1360
|
-
//
|
|
1361
|
-
//
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
!isTimeAnchor
|
|
1365
|
-
) {
|
|
1365
|
+
// Later records may be waiting behind a large FullSnapshot write.
|
|
1366
|
+
// Their temporary rejection must not invalidate that already-admitted
|
|
1367
|
+
// baseline. The recorder retries them after the encoder drains;
|
|
1368
|
+
// Meta/Focus within an atomic baseline use rejectBaselineTransaction.
|
|
1369
|
+
if (record.type === RecordType.FullSnapshot) {
|
|
1366
1370
|
failBaselineGeneration(
|
|
1367
1371
|
addResult.$rGeneration,
|
|
1368
1372
|
record.type === RecordType.FullSnapshot
|