diff --git a/docs/platforms/javascript/common/configuration/application-not-responding.mdx b/docs/platforms/javascript/common/configuration/event-loop-block.mdx similarity index 56% rename from docs/platforms/javascript/common/configuration/application-not-responding.mdx rename to docs/platforms/javascript/common/configuration/event-loop-block.mdx index 5e5cd4cb43534..1c18b01755fdf 100644 --- a/docs/platforms/javascript/common/configuration/application-not-responding.mdx +++ b/docs/platforms/javascript/common/configuration/event-loop-block.mdx @@ -1,7 +1,7 @@ --- -title: Application Not Responding (ANR) +title: Event Loop Block Detection sidebar_order: 70 -description: "Learn how to turn off or specify ANRs for Node.js" +description: "Monitor for blocked event loops in Node.js applications" supported: - javascript.node - javascript.aws-lambda @@ -25,6 +25,7 @@ supported: - javascript.tanstackstart-react keywords: [ + "event loop block", "anr", "Application Not Responding", "Event Loop Blocked", @@ -32,19 +33,43 @@ keywords: ] --- -Application Not Responding (ANR) errors, or Event Loop Stall errors, are triggered when the Node.js main thread event loop of an application is blocked for more than five seconds. The Node SDK reports ANR errors as Sentry events and can optionally attach a stack trace of the blocking code to the ANR event. +Event Loop Block detection monitors when the Node.js main thread event loop is blocked for more than a specified threshold. The Node SDK reports these events to Sentry with automatically captured stack traces to help identify blocking code. -ANR detection is not supported for [Node.js clusters](https://nodejs.org/api/cluster.html). +Event loop block detection is not supported for [Node.js clusters](https://nodejs.org/api/cluster.html). + + + +## Event Loop Block Integration (Recommended) + +For the best performance and comprehensive monitoring, we recommend using the [`eventLoopBlockIntegration`](./integrations/event-loop-block) from the `@sentry/node-native` package. Stack traces are automatically captured when blocking is detected. This integration can monitor all threads in your Node.js application and provides better performance compared to the deprecated ANR integration. + +```javascript +import * as Sentry from "@sentry/node"; +import { eventLoopBlockIntegration } from "@sentry/node-native"; + +Sentry.init({ + dsn: "___PUBLIC_DSN___", + integrations: [eventLoopBlockIntegration({ threshold: 1000 })], +}); +``` + +For detailed usage instructions and configuration options, see the [`eventLoopBlockIntegration`](./integrations/event-loop-block) documentation. + +## Deprecated Application Not Responding (ANR) Integration + + + +**Deprecated**: The `anrIntegration` is deprecated. Please use the [`eventLoopBlockIntegration`](./integrations/event-loop-block) instead for better performance and more comprehensive monitoring. _(Available in version 7.91.0 and above)_ -To enable ANR detection, add the `Anr` integration from the `@sentry/node` package. +The legacy ANR integration is still available but deprecated. If you're currently using it, we recommend migrating to the new `eventLoopBlockIntegration`. @@ -61,9 +86,9 @@ Sentry.init({ ![Example of an ANR error event](./img/anr-node-example.png) -## Configuration options +### Legacy ANR Configuration Options -You can pass a configuration object to the `Anr` integration to customize the ANR detection behavior. +The deprecated ANR integration supports the following configuration options: ```ts interface Options { @@ -90,9 +115,9 @@ interface Options { } ``` -## ANR Implementation and Overhead +### Legacy ANR Implementation and Overhead -ANR detection with the Node SDK uses a worker thread to monitor the event loop +ANR detection with the legacy Node SDK uses a worker thread to monitor the event loop in the main app thread. The main app thread sends a heartbeat message to the ANR worker thread every 50ms. If the ANR worker does not receive a heartbeat message for 5 seconds, it triggers an ANR event. If the `captureStackTrace` option is diff --git a/docs/platforms/javascript/common/configuration/integrations/anr.mdx b/docs/platforms/javascript/common/configuration/integrations/anr.mdx index 5f0fc9f7d3486..8461a7d6e123f 100644 --- a/docs/platforms/javascript/common/configuration/integrations/anr.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/anr.mdx @@ -24,6 +24,12 @@ supported: - javascript.tanstackstart-react --- + + +**Deprecated**: This integration is deprecated. Please use the [`eventLoopBlockIntegration`](./event-loop-block) instead for better performance and more comprehensive monitoring. + + + This integration only works in the Node.js runtime. @@ -32,7 +38,7 @@ This integration only works in the Node.js runtime. _Import name: `Sentry.anrIntegration`_ -The `anrIntegration` captures Application Not Responding (ANR)/Event Loop Stall errors and reports them as Sentry events. For more details, see the documentation on [ANR](../../application-not-responding). +The `anrIntegration` captures Application Not Responding (ANR)/Event Loop Stall errors and reports them as Sentry events. For more details, see the documentation on [Event Loop Block Detection](../../event-loop-block). ```JavaScript Sentry.init({ diff --git a/docs/platforms/javascript/guides/electron/configuration/application-not-responding.mdx b/docs/platforms/javascript/guides/electron/configuration/event-loop-block.mdx similarity index 91% rename from docs/platforms/javascript/guides/electron/configuration/application-not-responding.mdx rename to docs/platforms/javascript/guides/electron/configuration/event-loop-block.mdx index e643e6e6ca0c2..6953732abb459 100644 --- a/docs/platforms/javascript/guides/electron/configuration/application-not-responding.mdx +++ b/docs/platforms/javascript/guides/electron/configuration/event-loop-block.mdx @@ -1,7 +1,7 @@ --- -title: Application Not Responding (ANR) +title: Event Loop Block Detection sidebar_order: 70 -description: "Learn how to turn off or specify ANRs for Electron Main Thread" +description: "Monitor for blocked event loops in Electron applications" keywords: [ "anr", @@ -11,7 +11,7 @@ keywords: ] --- -Application Not Responding (ANR) errors, or Event Loop Stall errors, are +Event Loop Block errors, or Application Not Responding (ANR) errors are triggered when the Electron main or renderer processes event loop is blocked for more than five seconds. The Electron SDK reports ANR errors as Sentry events and can optionally attach a stack trace of the blocking code to the ANR event. @@ -79,7 +79,7 @@ interface Options { } ``` -## ANR Implementation and Overhead +## Application Not Responding (ANR) Implementation and Overhead ANR detection in the Electron main process uses a worker thread to monitor the event loop in the main app thread. The main app thread sends a heartbeat message to the ANR diff --git a/platform-includes/configuration/integrations/javascript.astro.mdx b/platform-includes/configuration/integrations/javascript.astro.mdx index 5189a6567e60b..82a79000747cb 100644 --- a/platform-includes/configuration/integrations/javascript.astro.mdx +++ b/platform-includes/configuration/integrations/javascript.astro.mdx @@ -74,6 +74,7 @@ Depending on whether an integration enhances the functionality of a particular r | [`prismaIntegration`](./prisma) | ✓ | | ✓ | | | [`vercelAiIntegration`](./vercelai) | ✓ | | ✓ | | | [`anrIntegration`](./anr) | | ✓ | | | +| [`eventLoopBlockIntegration`](./event-loop-block) | | ✓ | | | | [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ | | [`fsIntegration`](./fs) | | | ✓ | | | [`knexIntegration`](./knex) | | | ✓ | | diff --git a/platform-includes/configuration/integrations/javascript.aws-lambda.mdx b/platform-includes/configuration/integrations/javascript.aws-lambda.mdx index c38e7b1f5e7a5..da20b0d8372bb 100644 --- a/platform-includes/configuration/integrations/javascript.aws-lambda.mdx +++ b/platform-includes/configuration/integrations/javascript.aws-lambda.mdx @@ -21,6 +21,7 @@ | [`amqplibIntegration`](./amqplib) | | | ✓ | | | [`anrIntegration`](./anr) | | ✓ | | | | [`captureConsoleIntegration`](./captureconsole) | | | | ✓ | +| [`eventLoopBlockIntegration`](./event-loop-block) | | ✓ | | | | [`dataloaderIntegration`](./dataloader) | | | ✓ | | | [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ | | [`fsIntegration`](./fs) | | | ✓ | | diff --git a/platform-includes/configuration/integrations/javascript.connect.mdx b/platform-includes/configuration/integrations/javascript.connect.mdx index 4de92e46239f0..c5381631500bd 100644 --- a/platform-includes/configuration/integrations/javascript.connect.mdx +++ b/platform-includes/configuration/integrations/javascript.connect.mdx @@ -33,6 +33,7 @@ | [`vercelAiIntegration`](./vercelai) | ✓ | | ✓ | | | [`anrIntegration`](./anr) | | ✓ | | | | [`captureConsoleIntegration`](./captureconsole) | | | | ✓ | +| [`eventLoopBlockIntegration`](./event-loop-block) | | ✓ | | | | [`dataloaderIntegration`](./dataloader) | | | ✓ | | | [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ | | [`fsIntegration`](./fs) | | | ✓ | | diff --git a/platform-includes/configuration/integrations/javascript.fastify.mdx b/platform-includes/configuration/integrations/javascript.fastify.mdx index 12fa3b9c88a38..3e50202ca7c6c 100644 --- a/platform-includes/configuration/integrations/javascript.fastify.mdx +++ b/platform-includes/configuration/integrations/javascript.fastify.mdx @@ -33,6 +33,7 @@ | [`vercelAiIntegration`](./vercelai) | ✓ | | ✓ | | | [`anrIntegration`](./anr) | | ✓ | | | | [`captureConsoleIntegration`](./captureconsole) | | | | ✓ | +| [`eventLoopBlockIntegration`](./event-loop-block) | | ✓ | | | | [`dataloaderIntegration`](./dataloader) | | | ✓ | | | [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ | | [`fsIntegration`](./fs) | | | ✓ | | diff --git a/platform-includes/configuration/integrations/javascript.gcp-functions.mdx b/platform-includes/configuration/integrations/javascript.gcp-functions.mdx index 76be76e3ac923..93e081114ab14 100644 --- a/platform-includes/configuration/integrations/javascript.gcp-functions.mdx +++ b/platform-includes/configuration/integrations/javascript.gcp-functions.mdx @@ -21,6 +21,7 @@ | [`amqplibIntegration`](./amqplib) | | | ✓ | | | [`anrIntegration`](./anr) | | ✓ | | | | [`captureConsoleIntegration`](./captureconsole) | | | | ✓ | +| [`eventLoopBlockIntegration`](./event-loop-block) | | ✓ | | | | [`dataloaderIntegration`](./dataloader) | | | ✓ | | | [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ | | [`fsIntegration`](./fs) | | | ✓ | | diff --git a/platform-includes/configuration/integrations/javascript.hapi.mdx b/platform-includes/configuration/integrations/javascript.hapi.mdx index 6690807c00fce..eeb97654ea56d 100644 --- a/platform-includes/configuration/integrations/javascript.hapi.mdx +++ b/platform-includes/configuration/integrations/javascript.hapi.mdx @@ -33,6 +33,7 @@ | [`vercelAiIntegration`](./vercelai) | ✓ | | ✓ | | | [`anrIntegration`](./anr) | | ✓ | | | | [`captureConsoleIntegration`](./captureconsole) | | | | ✓ | +| [`eventLoopBlockIntegration`](./event-loop-block) | | ✓ | | | | [`dataloaderIntegration`](./dataloader) | | | ✓ | | | [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ | | [`fsIntegration`](./fs) | | | ✓ | | diff --git a/platform-includes/configuration/integrations/javascript.nestjs.mdx b/platform-includes/configuration/integrations/javascript.nestjs.mdx index c1838e3ae9e16..5709781760c40 100644 --- a/platform-includes/configuration/integrations/javascript.nestjs.mdx +++ b/platform-includes/configuration/integrations/javascript.nestjs.mdx @@ -33,6 +33,7 @@ | [`vercelAiIntegration`](./vercelai) | ✓ | | ✓ | | | [`anrIntegration`](./anr) | | ✓ | | | | [`captureConsoleIntegration`](./captureconsole) | | | | ✓ | +| [`eventLoopBlockIntegration`](./event-loop-block) | | ✓ | | | | [`dataloaderIntegration`](./dataloader) | | | ✓ | | | [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ | | [`fsIntegration`](./fs) | | | ✓ | | diff --git a/platform-includes/configuration/integrations/javascript.nextjs.mdx b/platform-includes/configuration/integrations/javascript.nextjs.mdx index af9ddbbe8e8a7..debf2424b04b2 100644 --- a/platform-includes/configuration/integrations/javascript.nextjs.mdx +++ b/platform-includes/configuration/integrations/javascript.nextjs.mdx @@ -79,6 +79,7 @@ Depending on whether an integration enhances the functionality of a particular r | [`childProcessIntegration`](./childProcess) | ✓ | | | ✓ | | [`prismaIntegration`](./prisma) | ✓ | | ✓ | | | [`anrIntegration`](./anr) | | ✓ | | | +| [`eventLoopBlockIntegration`](./event-loop-block) | | ✓ | | | | [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ | | [`fsIntegration`](./fs) | | | ✓ | | | [`knexIntegration`](./knex) | | | ✓ | | diff --git a/platform-includes/configuration/integrations/javascript.node.mdx b/platform-includes/configuration/integrations/javascript.node.mdx index 21e0b8ab6b959..9fcc6fb42926d 100644 --- a/platform-includes/configuration/integrations/javascript.node.mdx +++ b/platform-includes/configuration/integrations/javascript.node.mdx @@ -5,6 +5,7 @@ | [`amqplibIntegration`](./amqplib) | ✓ | | ✓ | | | [`anrIntegration`](./anr) | | ✓ | | | | [`captureConsoleIntegration`](./captureconsole) | | | | ✓ | +| [`eventLoopBlockIntegration`](./event-loop-block) | | ✓ | | | | [`childProcessIntegration`](./childProcess) | ✓ | | | ✓ | | [`consoleIntegration`](./console) | ✓ | | | ✓ | | [`contextLinesIntegration`](./contextlines) | ✓ | ✓ | | | diff --git a/platform-includes/configuration/integrations/javascript.nuxt.mdx b/platform-includes/configuration/integrations/javascript.nuxt.mdx index 73687500dc019..fe3227f1a55af 100644 --- a/platform-includes/configuration/integrations/javascript.nuxt.mdx +++ b/platform-includes/configuration/integrations/javascript.nuxt.mdx @@ -21,7 +21,7 @@ Depending on whether an integration enhances the functionality of a particular r ### Browser Integrations | | **Auto Enabled** | **Errors** | **Tracing** | **Replay** | **Additional Context** | -|-------------------------------------------------------|:----------------:|:----------:|:-----------:|:----------:|:----------------------:| +| ----------------------------------------------------- | :--------------: | :--------: | :---------: | :--------: | :--------------------: | | [`breadcrumbsIntegration`](./breadcrumbs) | ✓ | | | | ✓ | | [`browserApiErrorsIntegration`](./browserapierrors) | ✓ | ✓ | | | | | [`browserSessionIntegration`](./browsersession) | ✓ | | | | ✓ | @@ -73,6 +73,7 @@ Depending on whether an integration enhances the functionality of a particular r | [`prismaIntegration`](./prisma) | ✓ | | ✓ | | | [`vercelAiIntegration`](./vercelai) | ✓ | | ✓ | | | [`anrIntegration`](./anr) | | ✓ | | | +| [`eventLoopBlockIntegration`](./event-loop-block) | | ✓ | | | | [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ | | [`fsIntegration`](./fs) | | | ✓ | | | [`knexIntegration`](./knex) | | | ✓ | | diff --git a/platform-includes/configuration/integrations/javascript.remix.mdx b/platform-includes/configuration/integrations/javascript.remix.mdx index 96a94fd9ef407..243acaaca43af 100644 --- a/platform-includes/configuration/integrations/javascript.remix.mdx +++ b/platform-includes/configuration/integrations/javascript.remix.mdx @@ -21,7 +21,7 @@ Depending on whether an integration enhances the functionality of a particular r ### Browser Integrations | | **Auto Enabled** | **Errors** | **Tracing** | **Replay** | **Additional Context** | -|-------------------------------------------------------|:----------------:|:----------:|:-----------:|:----------:|:----------------------:| +| ----------------------------------------------------- | :--------------: | :--------: | :---------: | :--------: | :--------------------: | | [`breadcrumbsIntegration`](./breadcrumbs) | ✓ | | | | ✓ | | [`browserApiErrorsIntegration`](./browserapierrors) | ✓ | ✓ | | | | | [`browserSessionIntegration`](./browsersession) | ✓ | | | | ✓ | @@ -73,6 +73,7 @@ Depending on whether an integration enhances the functionality of a particular r | [`prismaIntegration`](./prisma) | ✓ | | ✓ | | | [`vercelAiIntegration`](./vercelai) | ✓ | | ✓ | | | [`anrIntegration`](./anr) | | ✓ | | | +| [`eventLoopBlockIntegration`](./event-loop-block) | | ✓ | | | | [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ | | [`fsIntegration`](./fs) | | | ✓ | | | [`knexIntegration`](./knex) | | | ✓ | | diff --git a/platform-includes/configuration/integrations/javascript.solidstart.mdx b/platform-includes/configuration/integrations/javascript.solidstart.mdx index f900ea624a6b6..0bbe29a566028 100644 --- a/platform-includes/configuration/integrations/javascript.solidstart.mdx +++ b/platform-includes/configuration/integrations/javascript.solidstart.mdx @@ -21,7 +21,7 @@ Depending on whether an integration enhances the functionality of a particular r ### Browser Integrations | | **Auto Enabled** | **Errors** | **Tracing** | **Replay** | **Additional Context** | -|-------------------------------------------------------|:----------------:|:----------:|:-----------:|:----------:|:----------------------:| +| ----------------------------------------------------- | :--------------: | :--------: | :---------: | :--------: | :--------------------: | | [`breadcrumbsIntegration`](./breadcrumbs) | ✓ | | | | ✓ | | [`browserApiErrorsIntegration`](./browserapierrors) | ✓ | ✓ | | | | | [`browserSessionIntegration`](./browsersession) | ✓ | | | | ✓ | @@ -73,6 +73,7 @@ Depending on whether an integration enhances the functionality of a particular r | [`prismaIntegration`](./prisma) | ✓ | | ✓ | | | [`vercelAiIntegration`](./vercelai) | ✓ | | ✓ | | | [`anrIntegration`](./anr) | | ✓ | | | +| [`eventLoopBlockIntegration`](./event-loop-block) | | ✓ | | | | [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ | | [`fsIntegration`](./fs) | | | ✓ | | | [`knexIntegration`](./knex) | | | ✓ | | diff --git a/platform-includes/configuration/integrations/javascript.sveltekit.mdx b/platform-includes/configuration/integrations/javascript.sveltekit.mdx index 743e028d75a7d..62cde94330cd2 100644 --- a/platform-includes/configuration/integrations/javascript.sveltekit.mdx +++ b/platform-includes/configuration/integrations/javascript.sveltekit.mdx @@ -72,6 +72,7 @@ Depending on whether an integration enhances the functionality of a particular r | [`prismaIntegration`](./prisma) | ✓ | | ✓ | | | [`vercelAiIntegration`](./vercelai) | ✓ | | ✓ | | | [`anrIntegration`](./anr) | | ✓ | | | +| [`eventLoopBlockIntegration`](./event-loop-block) | | ✓ | | | | [`extraErrorDataIntegration`](./extraerrordata) | | | | ✓ | | [`fsIntegration`](./fs) | | | ✓ | | | [`knexIntegration`](./knex) | | | ✓ | | diff --git a/redirects.js b/redirects.js index 64d12308c77ab..fe0fcc161f353 100644 --- a/redirects.js +++ b/redirects.js @@ -1107,6 +1107,17 @@ const userDocsRedirects = [ source: '/platforms/javascript/guides/:guide/tracing/trace-propagation/:path*', destination: '/platforms/javascript/guides/:guide/tracing/distributed-tracing/:path*', }, + { + source: + '/platforms/javascript/common/configuration/application-not-responding/:path*', + destination: '/platforms/javascript/common/configuration/event-loop-block/:path*', + }, + { + source: + '/platforms/javascript/guides/:guide/configuration/application-not-responding/:path*', + destination: + '/platforms/javascript/guides/:guide/configuration/event-loop-block/:path*', + }, { source: '/platforms/javascript/tracing/instrumentation/custom-instrumentation/:path*', destination: '/platforms/javascript/tracing/instrumentation/:path*',