Native Tools for the Official Sentry Node.js SDK

Installation
yarn add @sentry/node @sentry/node-native
npm install --save @sentry/node @sentry/node-native
eventLoopBlockIntegration
The eventLoopBlockIntegration can be used to monitor for blocked event loops in
all threads of a Node.js application.
If you instrument your application via the Node.js --import flag, Sentry will
be started and this instrumentation will be automatically applied to all worker
threads.
instrument.mjs
import * as Sentry from '@sentry/node';
import { eventLoopBlockIntegration } from '@sentry/node-native';
Sentry.init({
dsn: '__YOUR_DSN__',
integrations: [eventLoopBlockIntegration({ threshold: 500 })],
});
app.mjs
import { Worker } from 'worker_threads';
const worker = new Worker(new URL('./worker.mjs', import.meta.url));
worker.mjs
Start your application:
node --import instrument.mjs app.mjs
If a thread is blocked for more than the configured threshold, stack traces will
be captured for all threads and sent to Sentry.