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

feat: Renderer process ANR detection with stack traces #770

Merged
merged 9 commits into from
Oct 17, 2023

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Oct 6, 2023

When getsentry/sentry-javascript#9191 is merged, anr-utils.ts in this PR can be removed.

This PR adds ANR detection for the Electron renderer processes.

This is entirely configured from each renderer processes:

import { init } fron '@sentry/electron/renderer';

init({
  dsn: '__DSN__',
  anrDetection: { pollInterval: 200, anrThreshold: 2000, captureStackTrace: true },
})

Renderer ANR has no overhead unless a renderer starts sending ANR status updates to the main process.

@timfish timfish marked this pull request as ready for review October 6, 2023 15:01
@timfish timfish requested a review from AbhiPrasad October 8, 2023 13:42
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in favor of turning it on by default 👍

src/renderer/sdk.ts Outdated Show resolved Hide resolved
@timfish timfish marked this pull request as draft October 12, 2023 15:14
@timfish
Copy link
Collaborator Author

timfish commented Oct 12, 2023

This PR is still waiting on a few upstream bits to be released but it's now configured entirely from the renderer process.

import { init } fron '@sentry/electron/renderer';

init({
  dsn: '__DSN__',
  anrDetection: { pollInterval: 200, anrThreshold: 2000, captureStackTrace: true },
})

It also now enables renderer ANR by default but without stack traces enabled since this will add overhead.

Since renderer ANR is no longer configured form the main process, we should probably change how the main process ANR is configured since this was chosen to leave config points for the renderer.

Current:

await enableAnrDetection({ mainProcess: { captureStackTrace: true }});
runApp();

I think this should probably highlight its for the main process only:

await enableMainProcessAnrDetection({ captureStackTrace: true });
runApp();

@AbhiPrasad
Copy link
Member

anr utils changes released with https://github.com/getsentry/sentry-javascript/releases/tag/7.74.0

@timfish
Copy link
Collaborator Author

timfish commented Oct 13, 2023

Done, @AbhiPrasad what do you think about the above mentioned renaming of enableAnrDetection to enableMainProcessAnrDetection and removing the mainProcess config option?

@AbhiPrasad
Copy link
Member

Yeah I think let's use enableMainProcessAnrDetection here, makes it behavior very clear.

@timfish timfish marked this pull request as ready for review October 16, 2023 19:00
@timfish timfish merged commit 2bf8a54 into getsentry:master Oct 17, 2023
41 checks passed
@timfish timfish deleted the feat/anr-renderer branch October 17, 2023 16:39
@timfish timfish self-assigned this Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants