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

Is it possible to truncate start of events and still watch the replay? #14

Closed
ChuckJonas opened this issue Dec 28, 2018 · 5 comments
Closed
Labels
enhancement New feature or request

Comments

@ChuckJonas
Copy link
Contributor

I'd like to include this library in my error capture handler for an internal sales tool.

However, users might be on this page for quite some time, so I was hoping it would be possible to implement a "circular buffer" so I could capture just the last x events from when an error is logged.

Due to platform limitations, this would be more ideal than just saving every x seconds as your example shows.

Is it possible to start a replay for any point? I've done some quick testing and it doesn't seem to work, but maybe I'm just missing something?

@ChuckJonas
Copy link
Contributor Author

ChuckJonas commented Dec 29, 2018

Looking at my truncated attempts I think the problem is that my event are all EventType. IncrementalSnapshot.

So maybe this would be possible if I somehow was able to incrementally restart with EventType. FullSnapshot?

Seems like I could achieve something similar by just having 2-3 offset & restarting rrweb.record instances running at once, but since there is no way to stop recording (#16), I'm sure this is not a good idea.

@Yuyz0112
Copy link
Member

I think the stop recording ability can let you have a workaround solution. But it will be better if we add a take a full snapshot after N incremental snapshot option, is that what you need?

For example, take a full snapshot after 5 incremental snapshots will give you a snapshot chain like this:

FS1 -> IS1 -> ... -> IS5 -> FS2 -> IS6 -> ... -> IS10 -> FS3 -> ...

So you can replay from the latest full snapshot and drop the previous snapshots if you do not need them.

@Yuyz0112 Yuyz0112 added the enhancement New feature or request label Dec 31, 2018
@ChuckJonas
Copy link
Contributor Author

ChuckJonas commented Jan 5, 2019

@Yuyz0112
The latter solution you proposed could work for my use case. My only concern is that it might be tricky to balance performance due to variable activity (if the user was generating lots of events vs none at all).

I think a more robust solution would be to expose someway to trigger a full snapshot event emit yourself.

IMO, the most intuitive way of doing this would require changing the return of the record to an object (instead of just a stop function):

let recorder = rrweb.record({
  emit(event) {
    //save event
  },
});

//call recorder 'captureFullSnapshot' method every 10 sec
let fullCapture = setInterval(1000 * 10, recorder.captureFullSnapshot);

//stop after 1min
setTimeout(1000 * 60, () => { 
     recorder.stop();   
     clearInterval(fullCapture);
}); 

@Yuyz0112
Copy link
Member

Yuyz0112 commented Jan 6, 2019

@ChuckJonas how about provides two modes?
take one full snapshot after N incremental snapshot and take one full snapshot after N ms?
Expose something like captureFullsnapshot may look too low-level for most of the developers.

@Yuyz0112
Copy link
Member

@ChuckJonas Added this in #36, please let me know if you like it or not:)

lewgordon-amplitude pushed a commit to lewgordon-amplitude/rrweb that referenced this issue Aug 1, 2024
fix(rrweb): fix CSS parser for AddHover
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants