Skip to content

Is there any reason why Replay will be uploaded without errors? #58205

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

Closed
Zero-ruan opened this issue Oct 16, 2023 · 24 comments
Closed

Is there any reason why Replay will be uploaded without errors? #58205

Zero-ruan opened this issue Oct 16, 2023 · 24 comments
Assignees

Comments

@Zero-ruan
Copy link

Self-Hosted Version

"@sentry/react": "^7.72.0"

CPU Architecture

x86_64

Docker Version

20.10.16

Docker Compose Version

2.6.0

Steps to Reproduce

  • Calling replay.start() again after using replay.stop() did not work, but after I added await replay.setupOnce() it became normal. I don’t know if it has anything to do with this.
image

Expected Result

  • There shouldn't be any of these pointless Replays in existence right?

image

Actual Result

  • There are no exceptions in console and network

image

Event ID

No response

@hubertdeng123 hubertdeng123 transferred this issue from getsentry/self-hosted Oct 16, 2023
@getsantry
Copy link
Contributor

getsantry bot commented Oct 16, 2023

Assigning to @getsentry/support for routing ⏲️

@getsantry getsantry bot moved this from Waiting for: Product Owner to Waiting for: Support in GitHub Issues with 👀 Oct 16, 2023
@getsantry
Copy link
Contributor

getsantry bot commented Oct 16, 2023

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 👀 Oct 16, 2023
@Zero-ruan
Copy link
Author

Zero-ruan commented Oct 18, 2023

getsentry/sentry-javascript#8054 I found this and it seems to be the same question. However I am using ^7.72.0 .

@Zero-ruan
Copy link
Author

Will errors caused by browser plug-ins trigger replay? However, the console did not report any errors in the replay.

@billyvg
Copy link
Member

billyvg commented Oct 18, 2023

Can you confirm you are using self hosted and not SaaS?
Can you post your Sentry.init() configuration?

@Zero-ruan
Copy link
Author

Thanks for your reply, here is my init
image

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Oct 19, 2023
@billyvg
Copy link
Member

billyvg commented Oct 19, 2023

You have replaysSessionSampleRate set to 0.1, which means it'll capture 10% of all sessions (which may or may not have an error). ALso I'm not sure how you are using onStartReplay and onStopReplay, which may also be capturing replays w/o errors.

@Zero-ruan
Copy link
Author

Zero-ruan commented Oct 20, 2023

I will stop Replay when the user switches roles, start Replay after the user switches successfully, and setUser again to start a new Replay to record errors. So as long as replaysSessionSampleRate is used, this without error Replay will definitely exist, right?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Oct 20, 2023
@Zero-ruan
Copy link
Author

When I refresh, will run Sentry.init and replay.start again. It seems that this will generate a without error Replay. Is there a way to solve this? Because the error I want to record after the user switches roles is in a new Replay, Sentry.init and replay.start or stop are both performed during the role selection step after the user logs in.

image image image

@billyvg
Copy link
Member

billyvg commented Oct 23, 2023

So as long as replaysSessionSampleRate is used, this without error Replay will definitely exist, right?

Correct

You can use replay.startBuffering() instead of replay.start() if you only want replays with an error. startBuffering() will wait for an error to occur, check if it should be sampled, and then create a replay if so.

@Zero-ruan
Copy link
Author

Zero-ruan commented Oct 24, 2023

Thank you for your reply. When I refresh and re-execute Sentry.init and replay.startBuffering, a replay without errors will still be generated again. The effect is no different from using replay.start. I wonder if I have overlooked something?

image

@Zero-ruan
Copy link
Author

Sorry, this is a private project,I can't provide it, but I can provide my operating principle.
https://github.com/Zero-ruan/sentry/tree/main

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Oct 26, 2023
@billyvg
Copy link
Member

billyvg commented Oct 26, 2023

Sorry, this is a private project,I can't provide it, but I can provide my operating principle. https://github.com/Zero-ruan/sentry/tree/main

Just want to double check, is replaysSessionSampleRate set to 0? In this repo it is set to 1.

@Zero-ruan
Copy link
Author

I use 1 in my local environment because I found that when using 0.1, replay is not generated for the same type of error report after switching roles, so I need to use 1 to test.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Oct 27, 2023
@billyvg
Copy link
Member

billyvg commented Oct 30, 2023

Right but I thought you did not want replays without any errors? with replaysSessionSampleRate: 0, and using startBuffer() after role switch, you are still getting replays without errors?

@Zero-ruan
Copy link
Author

thank you for your reply, I used replaysSessionSampleRate: 0 and startBuffer(). This solves the problem of generating a replay without errors. However, when I make an 'ApolloError: Response not successful: Received status code 400' error, this generates a replay, which is fine. But when the error occurs again after switching roles, the error after switching roles does not generate a replay.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Oct 31, 2023
@Zero-ruan
Copy link
Author

I have tried different interfaces to generate this error, but no replay will be generated. However, if I make other types of errors such as (xxx is not a function), the replay will be generated again. It seems that it can only record the same type of error once. This is not good. I made an error when calling the interface at place A, and then I switched roles and made an error when calling another interface at place B. It can log the A error. But it does not record errors in the B interface

@Zero-ruan
Copy link
Author

Incidentally, I had to use replay.setupOnce() to start replay again after using replay.stop(), using replay.startBuffering() or replay.start() alone didn't work, and I don't see a description of this in the documentation.
image

@bruno-garcia
Copy link
Member

@Zero-ruan could you share a repro of the behavior your experiencing? We could go from there and either identify any bug or suggest a way to use the API to get the behavior you expect instead

@Zero-ruan
Copy link
Author

Sure, I updated this link: https://github.com/Zero-ruan/sentry/tree/main

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Nov 2, 2023
@bruno-garcia
Copy link
Member

Thanks @Zero-ruan, we'll take a look soon

@getsantry getsantry bot removed the status in GitHub Issues with 👀 Nov 3, 2023
@billyvg billyvg self-assigned this Dec 9, 2024
@billyvg
Copy link
Member

billyvg commented Dec 9, 2024

I'm going to close this ticket as the original issue is now fixed. Calling start() after a replay was stopped works as expected currently.

However there is still a problem where after a session has been stopped, we can't "restart" the session to capture onError. This issue has been captured in #77458

@billyvg billyvg closed this as completed Dec 9, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Dec 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Archived in project
Development

No branches or pull requests

4 participants