Skip to content

Configuration option to stop/disable post-crash replay recording on Android #6040

Description

@zhkvdm

Problem Statement

Currently, when an error/crash occurs, the SDK samples the event and continues recording post-crash replay until the session naturally ends. This replay is absolutely useless for us. I need a purely configuration-based way to completely prevent or instantly cut off replay recording right after a crash event occurs.

Solution Brainstorm

I would like a new configuration option in SentryReplayOptions (or a built-in behavior within beforeErrorSampling) that automatically stops the replay recorder immediately after a crash event is captured.

For example, a flag like stopRecordingOnCrash:

SentryAndroid.init(context) { options ->
  options.sessionReplay.onErrorSampleRate = 1.0
  // Proposed flag to cut off recording instantly after a crash/unhandled exception
  options.sessionReplay.isStopRecordingOnCrash = true 

  options.sessionReplay.beforeErrorSampling =
    SentryReplayOptions.BeforeErrorSamplingCallback { event, hint ->
      event.isCrashed // Only capture replays for crashes
    }
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions