Event Loop Block

Monitor for blocked event loops in all threads of a Node.js application.

Import name: eventLoopBlockIntegration from @sentry/node-native

The eventLoopBlockIntegration can be used to monitor for blocked event loops in all threads of a Node.js application. Stack traces are automatically captured when blocking is detected.

Copied
npm install @sentry/node-native

(Available in version 6.9.0 and above)

Copied
import * as Sentry from "@sentry/electron/main";
import { eventLoopBlockIntegration } from "@sentry/electron/native";

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  integrations: [eventLoopBlockIntegration({ threshold: 500 })],
});

You can pass a configuration object to the eventLoopBlockIntegration to customize the behavior:

Copied
interface ThreadBlockedIntegrationOptions {
  /**
   * Threshold in milliseconds to trigger an event.
   *
   * Defaults to 1000ms.
   */
  threshold: number;
  /**
   * Maximum number of blocked events to send per clock hour.
   *
   * Defaults to 1.
   */
  maxEventsPerHour: number;
  /**
   * Tags to include with blocked events.
   */
  staticTags: { [key: string]: Primitive };
}
Was this helpful?
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").