Skip to content

feat: Renderer process ANR detection with stack traces - #770

Merged
timfish merged 9 commits into
getsentry:masterfrom
timfish:feat/anr-renderer
Oct 17, 2023
Merged

feat: Renderer process ANR detection with stack traces#770
timfish merged 9 commits into
getsentry:masterfrom
timfish:feat/anr-renderer

Conversation

@timfish

@timfish timfish commented Oct 6, 2023

Copy link
Copy Markdown
Collaborator

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

@AbhiPrasad AbhiPrasad left a comment

Copy link
Copy Markdown
Contributor

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 👍

Comment thread src/renderer/sdk.ts Outdated
@timfish
timfish marked this pull request as draft October 12, 2023 15:14
@timfish

timfish commented Oct 12, 2023

Copy link
Copy Markdown
Collaborator Author

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
Copy Markdown
Contributor

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

@timfish

timfish commented Oct 13, 2023

Copy link
Copy Markdown
Collaborator Author

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

@AbhiPrasad

Copy link
Copy Markdown
Contributor

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
@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