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

[Feature Request]: Is there a way to merge events within a specified period of time? #1560

Open
1 task done
wqcstrong opened this issue Aug 27, 2024 · 6 comments
Open
1 task done
Labels
feature request Things want to be added

Comments

@wqcstrong
Copy link

Preflight Checklist

  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.

What package is this feature request for?

rrweb

Problem Description

image

Proposed Solution

/

Alternatives Considered

/

Additional Information

No response

@wqcstrong wqcstrong added the feature request Things want to be added label Aug 27, 2024
@wfk007
Copy link
Contributor

wfk007 commented Dec 16, 2024

@wqcstrong I have the idea to solve it, but In what scenarios would this be used?

@wfk007
Copy link
Contributor

wfk007 commented Dec 17, 2024

@wqcstrong
I have published a npm package named rrweb-events-merge powered by rrweb and rrweb-snapshot.

You can try it with:

  1. install dependencies
npm install rrweb-events-merge
  1. import and generate merged events
import { mergeEvents } from "rrweb-events-merge";

const mergedEvents = mergeEvents({
  events: events,
  startTimeStamp: startTimeStamp,
  endTimeStamp: endTimeStamp,
  iframe: iframe,
  snapshotOptions: {
    mirror,
  },
  onError: (error: string) => {
    console.error(error);
  },
});

Here is the repo: https://github.com/wfk007/rrweb-events-merge

@wqcstrong
Copy link
Author

@wfk007 Thx, I will take a look ❤️

but In what scenarios would this be used?

This repository https://github.com/HuolalaTech/page-spy-web/ provides the ability to replay runtime information on browser applications through log files. It now also supports log trimming, but now is achieved by manipulating time information, meaning the file size of rrweb remains unchanged. If events could be merged, it would be a significant breakthrough.

@wfk007
Copy link
Contributor

wfk007 commented Dec 23, 2024

@wqcstrong I opened a PR: #1616. Please help to confirm if this PR can solve your problem at your convenience.

@wqcstrong
Copy link
Author

@wqcstrong I opened a PR: #1616. Please help to confirm if this PR can solve your problem at your convenience.

Your implementation converts the complete events into mergedEvents in replay and pass it to Replayer. What I am hoping for is the ability to manipulate them after the recording is finished, before upload / download events and there is no iframe. The data flow is:

  1. User open the page: start recording;
  2. User finish some actions and click "Stop recording" button, let's say the size of total events is 10Mb;
  3. User select the start time and end time and click upload / download, the size of result events is 5Mb;

Then developer open the recording log, which is ready to replay and size is 5Mb. Perhaps I didn't express clearly, leading to your misunderstanding. If that's the case, I'm sorry!

@wfk007
Copy link
Contributor

wfk007 commented Dec 23, 2024

I think that you can try this approach to deal with the events(10MB) based on client replay before uploading or do it with jsdom in server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Things want to be added
Projects
None yet
Development

No branches or pull requests

3 participants
@wfk007 @wqcstrong and others