Net

Captures breadcrumbs and tracing spans for Electron's net module. Breadcrumbs and tracing spans are enabled by default, while sentry-trace headers are added to requests for all origins.

The integration can be configured via constructor options:

Copied
interface NetOptions {
  /**
   * Whether breadcrumbs should be captured for net requests
   *
   * Defaults to: true
   */
  breadcrumbs: boolean;
  /**
   * Whether to capture transaction spans for net requests
   *
   * Defaults to: true
   */
  tracing: boolean | (method: string, url: string) => boolean;
  /**
   * Whether to add 'sentry-trace' headers to outgoing requests
   *
   * Defaults to: true
   */
  tracingOrigins: boolean | (method: string, url: string) => boolean;
}

Here's a code example of how to disable breadcrumb capture and add sentry-trace headers to only capture spans for POST requests:

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

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  integrations: [
    Sentry.Integrations.Net({
      breadcrumbs: false,
      tracing: (method) => method == "POST",
      tracingOrigins: false,
    }),
  ],
});
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").