Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual replays are longer than recording #13791

Open
3 tasks done
rodolfoBee opened this issue Sep 25, 2024 · 4 comments
Open
3 tasks done

Manual replays are longer than recording #13791

rodolfoBee opened this issue Sep 25, 2024 · 4 comments
Labels
Package: react Issues related to the Sentry React SDK Package: replay Issues related to the Sentry Replay SDK

Comments

@rodolfoBee
Copy link
Member

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react

SDK Version

8.31.0 and 7.119.0

Framework Version

React 17.0.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

import * as Sentry from '@sentry/react'

Sentry.init({
  dsn: "__MY_DSN_",
  integrations: [
    Sentry.replayIntegration({
      maskAllText: false,
    }),
  ],
  replaysSessionSampleRate: 0.0,  
  replaysOnErrorSampleRate: 0.0,
  debug:true,
  });

class StartReplay extends React.Component{
  render(){
    return(
      <button onClick={() => {
        const replay = Sentry.getReplay();
        replay.flush()
        replay.start()
        console.log("Starting the replay")
      }}>START REPLAY</button>  
    )
  }
}

class StopReplay extends React.Component{
  render(){
    return(
      <button onClick={() => {
        const replay = Sentry.getReplay();
        console.log("Stopping the replay")
        replay.stop()
      }}>STOP REPLAY</button>  
    )
  }
}

ReactDOM.render([
    <StartReplay/>,
    <StopReplay/>,
  ], document.getElementById('root'));

Steps to Reproduce

  1. run the simple app above, it has 2 buttons: one to start a replay and one to stop the replay
  2. leave the page open for a while, you can move the mouse and click around.
  3. start the replay
  4. again move the mouse and do clicks
  5. stop the replay

Expected Result

The replay in sentry only has the movements from after the replay was started

Actual Result

The replay in sentry has a a period at the start when nothing is shown in the replay. Then it shows the "start replay" click and all the movements as expected until the replay is stopped.

There are no request sent to sentry before the replay starts, I could not identify why the Sentry UI is showing the freezed paged for such a long time before the actual start of the replay. Sample replays can be found in my organisation:
https://dev-curumas.sentry.io/replays/?project=5278835

@github-actions github-actions bot added the Package: react Issues related to the Sentry React SDK label Sep 25, 2024
@Lms24 Lms24 added the Package: replay Issues related to the Sentry Replay SDK label Sep 25, 2024
@Lms24
Copy link
Member

Lms24 commented Sep 25, 2024

Hey, so I can reproduce this (example) myself in a test app. I think this is happening because of some replay breadcrumbs we emit. which are happening after the page initially loads:

Image

@c298lee gonna tag you since you looked recently into replay web vital breadcrumbs: Any chance that there is a problem with us collecting/buffering breadcrumbs if there's no active replay (but replayIntegration was initialized)?
I'm btw not 100% sure of this is only limited to web vital breadcrumbs, given we also show the pageload/reload breadcrumb before the web vital crumbs.

@Lms24
Copy link
Member

Lms24 commented Sep 25, 2024

Here's my reproduction app btw. It's basically just the example from the issue description pasted into a Vite React 17 app: https://github.com/Lms24/gh-sentry-javascript-13791-replay-manual-start-stop

@c298lee
Copy link
Member

c298lee commented Sep 25, 2024

Looks like it's the same issue as this one: https://github.com/getsentry/team-replay/issues/451.
It looks like there's activity in the network tab before start is clicked, which is causing the longer replay. I'll take closer look with @billyvg when he's back from vacation

@c298lee
Copy link
Member

c298lee commented Oct 2, 2024

This is happening due to buffered events happening at an earlier timestamp (including web vitals) being added to the replay. We will discuss how we want to handle this Monday, because we think events such as web vitals are nice to show, however it is confusing for the user to see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: react Issues related to the Sentry React SDK Package: replay Issues related to the Sentry Replay SDK
Projects
Status: Waiting for: Product Owner
Development

No branches or pull requests

3 participants