Commit 0a531f5
authored
feat: Limit accumulating canvas buffer (#101)
RRWeb Canvas is being updated by draw commands and they all kept in the
browser memory. Pr makes SR to reset this Canvas cache by pushing
FullSnapshot after 10mb of canvas payloads
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Tracks canvas payload size (~10MB limit) to decide between incremental
draws and full snapshots, refactors event data types, and adds
SessionReplay tests.
>
> - **Session Replay**:
> - Enforce RRWeb canvas buffer cap (~10MB) via
`generatingCanvasSize`/`pushedCanvasSize`; trigger `FullSnapshot` when
exceeded; otherwise issue incremental `drawImage`.
> - Add `RRWebPlayerConstants`, track per-event `canvasSize`, and update
size after payload push (`updatePushedCanvasSize`).
> - Optimize image handling (reuse base64 string, pass `rr_dataURL` into
`ExportImage.eventNode`).
> - **RRWeb event model refactor**:
> - Replace generic `EventData` with specific `WindowData`,
`MouseInteractionData`, `MouseMoveEventData`, and `DomData` (with
transitional `canvasSize`).
> - Extend `CanvasDrawData/AnyCommand` to carry `canvasSize`; adjust
decoding in `AnyEventData`.
> - **Exporter**:
> - After `pushPayload`, flush accumulated canvas size in
`SessionReplayEventGenerator`.
> - **GraphQL**:
> - Make `GraphQLClient.endpoint` private.
> - **Build & Tests**:
> - Add `SessionReplayTests` target and scheme entry.
> - New tests validate draw vs full snapshot behavior based on canvas
buffer limit.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
841f989. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 2797716 commit 0a531f5
File tree
16 files changed
+266
-132
lines changed- Sources
- Common/GraphQL
- LaunchDarklySessionReplay
- Exporter
- Operations
- RRWeb
- ScreenCapture
- TestApp/Sources
- Tests/SessionReplayTests
16 files changed
+266
-132
lines changedLines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
95 | 102 | | |
96 | 103 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
Lines changed: 49 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
11 | 20 | | |
12 | 21 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
16 | 25 | | |
17 | 26 | | |
18 | 27 | | |
19 | 28 | | |
20 | | - | |
21 | | - | |
| 29 | + | |
| 30 | + | |
22 | 31 | | |
23 | 32 | | |
24 | 33 | | |
| 34 | + | |
| 35 | + | |
25 | 36 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
30 | 41 | | |
31 | 42 | | |
32 | 43 | | |
| |||
37 | 48 | | |
38 | 49 | | |
39 | 50 | | |
| 51 | + | |
40 | 52 | | |
41 | 53 | | |
42 | 54 | | |
| |||
56 | 68 | | |
57 | 69 | | |
58 | 70 | | |
59 | | - | |
| 71 | + | |
60 | 72 | | |
61 | 73 | | |
62 | 74 | | |
63 | 75 | | |
64 | 76 | | |
65 | 77 | | |
66 | 78 | | |
67 | | - | |
| 79 | + | |
68 | 80 | | |
69 | 81 | | |
70 | 82 | | |
| |||
91 | 103 | | |
92 | 104 | | |
93 | 105 | | |
94 | | - | |
| 106 | + | |
| 107 | + | |
95 | 108 | | |
96 | 109 | | |
97 | 110 | | |
| |||
122 | 135 | | |
123 | 136 | | |
124 | 137 | | |
125 | | - | |
| 138 | + | |
126 | 139 | | |
127 | 140 | | |
128 | 141 | | |
129 | 142 | | |
130 | 143 | | |
131 | 144 | | |
132 | | - | |
| 145 | + | |
133 | 146 | | |
134 | 147 | | |
135 | 148 | | |
| |||
145 | 158 | | |
146 | 159 | | |
147 | 160 | | |
148 | | - | |
| 161 | + | |
149 | 162 | | |
150 | 163 | | |
151 | 164 | | |
| |||
162 | 175 | | |
163 | 176 | | |
164 | 177 | | |
165 | | - | |
166 | 178 | | |
167 | 179 | | |
168 | 180 | | |
| |||
174 | 186 | | |
175 | 187 | | |
176 | 188 | | |
177 | | - | |
178 | | - | |
179 | 189 | | |
180 | | - | |
| 190 | + | |
181 | 191 | | |
182 | 192 | | |
183 | 193 | | |
| |||
232 | 242 | | |
233 | 243 | | |
234 | 244 | | |
235 | | - | |
| 245 | + | |
| 246 | + | |
236 | 247 | | |
237 | 248 | | |
238 | 249 | | |
| |||
244 | 255 | | |
245 | 256 | | |
246 | 257 | | |
247 | | - | |
248 | | - | |
| 258 | + | |
| 259 | + | |
249 | 260 | | |
250 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
251 | 265 | | |
252 | 266 | | |
253 | 267 | | |
| |||
264 | 278 | | |
265 | 279 | | |
266 | 280 | | |
267 | | - | |
268 | | - | |
| 281 | + | |
269 | 282 | | |
| 283 | + | |
| 284 | + | |
270 | 285 | | |
271 | 286 | | |
272 | 287 | | |
273 | | - | |
| 288 | + | |
274 | 289 | | |
275 | 290 | | |
276 | 291 | | |
277 | | - | |
| 292 | + | |
| 293 | + | |
278 | 294 | | |
279 | 295 | | |
280 | 296 | | |
281 | | - | |
| 297 | + | |
282 | 298 | | |
283 | 299 | | |
284 | 300 | | |
285 | 301 | | |
286 | 302 | | |
287 | | - | |
| 303 | + | |
288 | 304 | | |
289 | 305 | | |
290 | 306 | | |
291 | 307 | | |
292 | 308 | | |
293 | 309 | | |
294 | 310 | | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
295 | 315 | | |
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
| 102 | + | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
104 | 107 | | |
105 | 108 | | |
106 | 109 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| |||
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| 31 | + | |
| 32 | + | |
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
| |||
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
35 | | - | |
36 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
37 | 46 | | |
38 | 47 | | |
39 | 48 | | |
| |||
42 | 51 | | |
43 | 52 | | |
44 | 53 | | |
| 54 | + | |
45 | 55 | | |
46 | 56 | | |
47 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
0 commit comments