Commit 72f2592
authored
feat: Limit accumulating canvas buffer (#322)
## Summary
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]
> Track accumulated canvas draw size with a configurable limit to force
full snapshots; serialize exports and update tests.
>
> - **Replay exporter (`RRwebGraphQLReplayLogExporter`)**:
> - Add configurable `canvasBufferLimit` and `canvasDrawEntourage`
(defaults ~10MB, 300 bytes) and track
`generatingCanvasSize`/`pushedCanvasSize`.
> - Trigger full snapshot when accumulated canvas size exceeds limit, in
addition to session/size changes.
> - Update size accounting on incremental and full events; flush size
after `pushPayload`.
> - Ensure single-threaded export with `Mutex` around export to protect
counters.
> - **Tests**:
> - Add `test canvas buffer limit` validating full snapshot when limit
exceeded.
> - Pass buffer config into exporter setup; adjust verifiers to accept
expected counts.
> - Minor test cleanups/wording tweaks.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
2117644. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 3c6a77b commit 72f2592
File tree
2 files changed
+77
-13
lines changed- sdk/@launchdarkly/observability-android/lib/src
- main/kotlin/com/launchdarkly/observability/replay
- test/kotlin/com/launchdarkly/observability/replay
2 files changed
+77
-13
lines changedLines changed: 25 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| |||
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
36 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
37 | 43 | | |
38 | 44 | | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
| |||
56 | 63 | | |
57 | 64 | | |
58 | 65 | | |
| 66 | + | |
| 67 | + | |
59 | 68 | | |
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
63 | 72 | | |
| 73 | + | |
| 74 | + | |
64 | 75 | | |
| 76 | + | |
| 77 | + | |
65 | 78 | | |
66 | 79 | | |
67 | 80 | | |
| |||
80 | 93 | | |
81 | 94 | | |
82 | 95 | | |
83 | | - | |
| 96 | + | |
| 97 | + | |
84 | 98 | | |
85 | 99 | | |
86 | 100 | | |
| |||
126 | 140 | | |
127 | 141 | | |
128 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
129 | 146 | | |
130 | 147 | | |
131 | 148 | | |
| |||
142 | 159 | | |
143 | 160 | | |
144 | 161 | | |
| 162 | + | |
145 | 163 | | |
146 | 164 | | |
147 | 165 | | |
| |||
259 | 277 | | |
260 | 278 | | |
261 | 279 | | |
| 280 | + | |
262 | 281 | | |
263 | 282 | | |
264 | 283 | | |
| |||
342 | 361 | | |
343 | 362 | | |
344 | 363 | | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
345 | 367 | | |
346 | 368 | | |
347 | 369 | | |
| |||
Lines changed: 52 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
65 | | - | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
176 | 178 | | |
177 | 179 | | |
178 | 180 | | |
179 | | - | |
180 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
181 | 223 | | |
182 | 224 | | |
183 | 225 | | |
| |||
429 | 471 | | |
430 | 472 | | |
431 | 473 | | |
432 | | - | |
| 474 | + | |
433 | 475 | | |
434 | 476 | | |
435 | 477 | | |
436 | 478 | | |
437 | 479 | | |
438 | | - | |
439 | | - | |
440 | | - | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
441 | 483 | | |
442 | 484 | | |
443 | 485 | | |
| |||
446 | 488 | | |
447 | 489 | | |
448 | 490 | | |
449 | | - | |
| 491 | + | |
450 | 492 | | |
451 | 493 | | |
452 | | - | |
| 494 | + | |
453 | 495 | | |
454 | 496 | | |
0 commit comments