MainProcessSession

Captures sessions linked to the lifetime of the Electron main process. Capturing sessions makes it possible to show release health statistics in Sentry.

If you'd prefer to capture sessions linked to the focus of BrowserWindow's, use the BrowserWindowSession integration.

Unless autoSessionTracking is set to false, this integration will be automatically added.

Copied
import * as Sentry from "@sentry/electron";

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  autoSessionTracking: false,
});

The default behavior is to only send sessions on error or when the main process ends. To send sessions when the main process is created, enable the sendOnCreate option.

Copied
import * as Sentry from "@sentry/electron";

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  integrations: [
    new Sentry.Integrations.MainProcessSession({ sendOnCreate: true }),
  ],
});
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").