Skip to content

Handle replay events in a queue #6639

@mydea

Description

@mydea

Replay events depend a lot on the order they are sent, as the recordings are basically incremental.
this means that a whole bunch of issues can arise when one or multiple payloads are lost/not sent in the correct order.

Some related issues:

I propose to instead change how we send replays by start to use a queue of outstanding events instead. This could work something like this:

  1. When a segment is ready to be sent, it is added to the bottom of the queue.
  2. Each e.g. second, we try to send the top item of the queue. If it fails, it remains on the top of the queue, else it is removed.

This means that we can always ensure that all events are sent in order.

There are two additional wrinkles with this:

a) We need to make sure to send all queue items when the user is leaving the page
b) We may want to store unsent queue items in session storage, so we can recover them after e.g. the user was offline

These two are a bit contradictory, as if we send everything on unload, we can't be sure that is has been sent, so we can't really decide if we need to remove it from a local storage 🤔

Metadata

Metadata

Assignees

Labels

Package: replayIssues related to the Sentry Replay SDK

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions