Skip to content

Restart onError sampling for replays after stopping #77458

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

Open
dalnoki opened this issue Sep 13, 2024 · 4 comments
Open

Restart onError sampling for replays after stopping #77458

dalnoki opened this issue Sep 13, 2024 · 4 comments

Comments

@dalnoki
Copy link
Contributor

dalnoki commented Sep 13, 2024

Problem Statement

We received the following message from a customer:

One account in our team has multiple roles that can be switched. We hope that when the user switches roles, the errors that occur will be recorded in a new Replays.
The latest version does not have replay.setupOnce(). Simply using replay.stop() and replay.start() will not generate new Replays. I only want to use replaysOnErrorSampleRate, because if replaysSessionSampleRate or tracesSampleRate is used, replay.start() will be executed when switching users, and then a Replay without error records will be generated.

Solution Brainstorm

Expose a public API to allow for restarting of onError sampling after replay has been stopped.

Product Area

Replays

@getsantry
Copy link
Contributor

getsantry bot commented Sep 13, 2024

Assigning to @getsentry/support for routing ⏲️

@getsantry
Copy link
Contributor

getsantry bot commented Sep 13, 2024

Routing to @getsentry/product-owners-replays for triage ⏲️

@getsantry getsantry bot moved this from Waiting for: Support to Waiting for: Product Owner in GitHub Issues with 👀 3 Sep 13, 2024
@Zero-ruan
Copy link

Zero-ruan commented Sep 13, 2024

Image

I didn’t make many changes to the version that allowed the use of setupOnce(). In the old version, I used replay.setupOnce() followed by replay.startBuffering(), which successfully reopened a replay after executing replay.stop(). However, after upgrading, I found that setupOnce() is no longer available, and simply executing replay.startBuffering() or replay.start() does not start a new replay. I couldn’t find a solution for this in the documentation.

@billyvg
Copy link
Member

billyvg commented Sep 16, 2024

@Zero-ruan This is a bit hacky because it's using a private method, but you can call this after switching users: replay && replay['_initialize'](Sentry.getClient()); -- we will consider adding a public API for this in the future

@billyvg billyvg changed the title Handling Replay Generation on role switch Restart onError sampling for replays after stopping Sep 16, 2024
@linear linear bot added the Migrated label Jan 9, 2025
@gaprl gaprl removed the Migrated label Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

4 participants