getsentry / sentry-react-native

Official Sentry SDK for React Native
https://sentry.io
MIT License
1.57k stars 337 forks source link

Session replays recording while app is in background #4047

Open hammoudma opened 2 months ago

hammoudma commented 2 months ago

OS:

Platform:

SDK:

SDK version: 8.33.0

react-native version: 0.74.0

Are you using Expo?

Are you using sentry.io or on-premise?

Configuration:

(@sentry/react-native)

Sentry.init({
      dsn: SENTRY_DSN,
      environment: SENTRY_ENVIRONMENT,
      _experiments: {
        replaysSessionSampleRate: 0,
        replaysOnErrorSampleRate: 1.0
      },
      integrations: [
        Sentry.mobileReplayIntegration({
          maskAllText: false,
          maskAllImages: false
        })
      ]
    });

I have the following issue:

I am getting hours-long replay sessions of the app idling in the background. Is there a way to disable that? I am assuming that that is also happening when the app is open and then the screen is locked.

Expected result:

I only get replays of user sessions were the user is using the app.

krystofwoldrich commented 2 months ago

Hi @hammoudma,

thank you for the message,

could you describe more in detail, how to reproduce the behaviour?

I've tried to open our sample app, capture an error, lock the simulator screen and unlock it 10 minutes later, the replay shows the app was suspended for the 10 minutes.

hammoudma commented 2 months ago

Hi @krystofwoldrich

Sorry I wasnt clear in the description, the replays I am getting are not of an error, they are just of the app idling for a long time.

Image

For example, is there a way to get rid of these or limit the recording time

krystofwoldrich commented 2 months ago

@hammoudma Thank you for the explanation. I understand now.

krystofwoldrich commented 2 months ago

@brustolin @romtsn Does the current Replay length limit includes the inactive/paused replay time?

brustolin commented 2 months ago

Technically, yes, but this should not happen. Once it goes into the background for more than 30 seconds, we should not consider it the same session.

krystofwoldrich commented 2 months ago

Bump cocoa when https://github.com/getsentry/sentry-cocoa/pull/4303 is released.