sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Replay `start()` can include old "history" events that are not relevant to the replay

Open billyvg opened this issue 1 year ago • 2 comments

When calling start(), we always include a breadcrumb for the initial page navigation. This should not always be included and will cause the replay to appear to start earlier than when the public start() function is actually caused.

To repro:

  • set sample rates to 0 (we want manual recording)
  • reload page (this will create the navigation.reload breadcrumb)
  • wait seconds
  • observe current time and then call replay.start()
  • console.log something so that it gets record to replay

You'll see that we get a navigation breadcrumb at time = 0 and the console.log happens at time = x

billyvg avatar May 10 '24 19:05 billyvg

I am not sure I understand this 🤔 what exactly is happening/should not be happening? We do not add a breadcrumb for start, I believe...? Or at least I do not know which breadcrumb this is refering to 😅

mydea avatar May 13 '24 09:05 mydea

I think it's the handleHistorySpanListener -- basically what happens is that we call start() seconds after pageload, we will have breadcrumbs from around pageload time. In the replay it'll look like we have nothing happening for seconds until the time we actually call start.

I haven't verified this closely yet, but this seems like what is happening.

billyvg avatar May 13 '24 13:05 billyvg

Released with https://github.com/getsentry/sentry-javascript/releases/tag/8.8.0

AbhiPrasad avatar Jun 07 '24 16:06 AbhiPrasad