Skip to content

Ensure replays do not have filtered out errors attached #6285

Closed
@mydea

Description

@mydea

Replays attach errors that happened while the replay was running via errorIds.
This is basically a global event processor that adds the ID of each error event it gets to the errorIds set, which in turn ends up being sent to Sentry.

However, turns out that in reality sometimes this includes IDs of error events that do not actually exist on Sentry, leading to weird behavior.

After some investigation, the most probable cause of this is that some of the error events are sampled away after they have been "consumed" by the replay event processor. Some reasons that could lead to this are:

  • The deduplication integration removes them
  • They are dropped due to rate limiting
  • They are dropped by the host app via a custom beforeSend hook or another global event processor
  • They are dropped when being sent over the network (e.g. failed HTTP request, ...)

In order to fix (or at least, mostly fix), all but the last of these issues, we should introduce some logic that removes eventIds that have been dropped.

Alternatives that have been investigated

Some other ideas we thought about, but ultimately discarded:

  • Introduce an afterSend hook: This may not work, as an error could be send at the same time or after a replay was sent.
  • Introduce some custom hooks for this that are always called: Tricky and expands public API surface noticeably.
  • Monkey patch beforeSend: Can be done, but potentially tricky, as this is/can be user configured.

Proposed solution

We should monkey patch recordDroppedEvent on the client. This is called when an event is dropped either because of returning null from beforeSend / a global event processor, or when dropped due to rate limiting.

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