-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Electron SDK v3 Proposal #360
Comments
Merged
Really relieved to see your PR in the pipeline. We run a couple of electron apps and can't help but notice it falling behind (i.e. really missing sessions). Many thanks for the refactor! |
Closed
This is now available for testing under the |
This has been released as 3.0.0! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current SDK has a single entry point which should be called in the main, preload and renderer processes. This can make getting started simple but also:
electron
to externalselectron-preload
target uses the wrong importI am proposing refactoring the SDK to be thinner layers on top of the node/browser SDKs. The Electron specific functionality and optional features would then be added as integrations. This will give the greatest flexibility and allow SDK users to pick and choose which feature they would like.
Main Process
Accessible via:
@sentry/node
withElectronNetTransport
and the following integrations:ElectronBreadcrumbs
(default)- Adds breadcrumbs for Electron eventsOnUncaughtException
(default) - Electron specificuncaughtException
handlingMainContext
(default) - Adds OS/platform context to eventsAdditionalContext
(default) - Includes addition device context like screen resolution, CPU/memory infoMainProcessSession
(default whenoptions.autoSessionTracking !== false
) - Tracks sessions as the main process lifetimeSentryMinidump
(default) - Sends minidumps via Sentry Envelope endpoint with full context/breadcrumbsElectronMinidump
- Sends minidumps via Electron built in uploader with partial contextPreloadInjection
(default) - Automatically injects preload script viasession.addPreloads()
apiChildProcess
(default) - Includes breadcrumbs for events with Electrons sub processesPreload
Accessible via:
The preload is simply a 10-20 line script that:
contextBridge
when enabledcrashReporter.start()
for older Electron versions where this is still required in the rendererBy default, the
PreloadInjection
integration will attempt to inject preload scripts where possible. This will not work when the main process but the SDK will fall back to sending events and scope to the main process via a custom protocol andfetch
Renderer Process
Accessible via:
@sentry/browser
with the following integrations:ScopeToMain
(default) - Sends scope updates to the main process to be merged and give more detail with minidumpsEventToMain
(default) - Sends events via the main processUsage
With all the default integrations and for non-bundled usage, the instructions will remain much the same.
Call
init
in the main and renderer processes:sentry.js
main.js
andrenderer.js
Complex configurations
By using
@sentry/electron/renderer
or@sentry/electron/main
you gain access to the configuration, type definitions and integrations for the specific process type.Browser Tracing
renderer.js
Disabling minidumps
In the main process, remove the
SentryMinidump
integrationUsing the Electron minidump uploader
In the main process, add the
ElectronMinidump
integration and the SDK automatically removes theSentryMinidump
integration.The text was updated successfully, but these errors were encountered: