Skip to content

feat: Session Replay improvements#53

Merged
abelonogov-ld merged 5 commits intomainfrom
andrey/sr-optimization1
Oct 28, 2025
Merged

feat: Session Replay improvements#53
abelonogov-ld merged 5 commits intomainfrom
andrey/sr-optimization1

Conversation

@abelonogov-ld
Copy link
Copy Markdown
Contributor

@abelonogov-ld abelonogov-ld commented Oct 28, 2025

  • Pause snapshotting if buffer is overflowed
  • Allow snapshotting during user interaction
  • Internal FPS counters
  • Code sugar
  • Add logging in parts of Session Player

Note

Adds buffer-aware screenshot capture with player wake-up events and optional SR stats, refactors event queue API and batch worker (logging + adaptive pacing), and enhances HTTP error descriptions.

  • Session Replay:
    • Event generation: Introduces wake-up payloads (generateWakeUpEvents), applies consistent padding to interactions, and rebuilds full snapshot sizing via paddedWidth/Height.
    • ExportImage: Optimizes equality with dataHashValue; properties now immutable.
    • Snapshotting: SnapshotTaker checks EventQueue.isFull() before capturing; uses eventQueue.send(_ payload) and @MainActor capture.
    • Stats: Adds SessionReplayStats for periodic image/FPS logging (debug-only path).
  • Transport/Queue:
    • EventQueue: API change to send(_ payload: EventQueueItemPayload); adds isFull(); internal fields privatized.
    • BatchWorker: Accepts OSLog, logs export errors via os_log, and uses adaptive sleep with a minimum interval.
  • Observability:
    • Updates to use new EventQueue.send across log/memory/lifecycle/user-interaction producers; BatchWorker now initialized with options.log.
  • Networking:
    • NetworkError.httpStatus description now includes optional response body data.

Written by Cursor Bugbot for commit 4d83e20. This will update automatically on new commits. Configure here.

Squashed commits:
[2231514] Turn off snapshotting is queue is full
[dc5f244] chore: add logging into session replay
@abelonogov-ld abelonogov-ld requested a review from a team as a code owner October 28, 2025 16:43
@abelonogov-ld abelonogov-ld changed the title Feat: Session Replay improvements feat: Session Replay improvements Oct 28, 2025
@abelonogov-ld abelonogov-ld enabled auto-merge (squash) October 28, 2025 18:10
send(EventQueueItem(payload: payload))
}

func send(_ item: EventQueueItem) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Dequeue Cost Mismatch

In the dequeue method, when the limit or cost threshold is reached, only the cost of the last item is subtracted from currentSize, but i+1 items (all accumulated items) are removed from storage. This causes currentSize to become incorrect. The line currentSize -= item.cost should subtract the sum of costs of all i+1 items being removed, not just the last one.

Fix in Cursor Fix in Web

@abelonogov-ld abelonogov-ld merged commit 45c4cbc into main Oct 28, 2025
5 checks passed
@abelonogov-ld abelonogov-ld deleted the andrey/sr-optimization1 branch October 28, 2025 18:12
abelonogov-ld pushed a commit that referenced this pull request Oct 28, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.7.0](0.6.0...0.7.0)
(2025-10-28)


### Features

* Session Replay improvements
([#53](#53))
([45c4cbc](45c4cbc))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Bumps version to 0.7.0 and updates changelog with Session Replay
improvements.
> 
> - **Versioning**:
>   - Update `.release-please-manifest.json` to `0.7.0`.
> - **Changelog**:
>   - Add `0.7.0` section noting Session Replay improvements.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e9a0935. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants