@watchforge/browser 0.1.23 → 0.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/package.json +1 -1
- package/src/contexts.js +1 -1
- package/src/replay.js +6 -10
- package/src/tracing.js +1 -1
package/package.json
CHANGED
package/src/contexts.js
CHANGED
|
@@ -7,7 +7,7 @@ const isNode =
|
|
|
7
7
|
typeof process !== "undefined" && process.versions && process.versions.node;
|
|
8
8
|
|
|
9
9
|
export const SDK_NAME = "@watchforge/browser";
|
|
10
|
-
export const SDK_VERSION = "0.1.
|
|
10
|
+
export const SDK_VERSION = "0.1.24";
|
|
11
11
|
|
|
12
12
|
export function getSdkMetadata() {
|
|
13
13
|
return {
|
package/src/replay.js
CHANGED
|
@@ -41,17 +41,11 @@ function shouldSample(rate) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function trimBuffer(now = Date.now()) {
|
|
44
|
-
events = events.filter((event) => now - event.timestamp <= MAX_BUFFER_MS);
|
|
45
|
-
if (events.length <= MAX_EVENTS) return;
|
|
46
|
-
|
|
47
|
-
const tail = events.slice(-MAX_EVENTS);
|
|
48
|
-
if (tail.some((event) => event.type === RRWEB_FULL_SNAPSHOT)) {
|
|
49
|
-
events = tail;
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
44
|
const fullSnapshotIndex = findLastEventIndex(events, RRWEB_FULL_SNAPSHOT);
|
|
54
45
|
if (fullSnapshotIndex === -1) {
|
|
46
|
+
events = events.filter((event) => now - event.timestamp <= MAX_BUFFER_MS);
|
|
47
|
+
if (events.length <= MAX_EVENTS) return;
|
|
48
|
+
const tail = events.slice(-MAX_EVENTS);
|
|
55
49
|
events = tail;
|
|
56
50
|
return;
|
|
57
51
|
}
|
|
@@ -65,8 +59,10 @@ function trimBuffer(now = Date.now()) {
|
|
|
65
59
|
events[fullSnapshotIndex],
|
|
66
60
|
];
|
|
67
61
|
const remainingSlots = Math.max(MAX_EVENTS - anchorEvents.length, 0);
|
|
62
|
+
|
|
68
63
|
const recentEvents = events
|
|
69
64
|
.slice(fullSnapshotIndex + 1)
|
|
65
|
+
.filter((event) => now - event.timestamp <= MAX_BUFFER_MS)
|
|
70
66
|
.slice(-remainingSlots);
|
|
71
67
|
|
|
72
68
|
events = [...anchorEvents, ...recentEvents].sort(
|
|
@@ -178,7 +174,7 @@ export function flushReplayForEvent(dsn, eventId) {
|
|
|
178
174
|
events,
|
|
179
175
|
sdk: {
|
|
180
176
|
name: "@watchforge/browser",
|
|
181
|
-
version: "0.1.
|
|
177
|
+
version: "0.1.24",
|
|
182
178
|
},
|
|
183
179
|
};
|
|
184
180
|
|
package/src/tracing.js
CHANGED