diff --git a/docs/platforms/javascript/guides/nestjs/features/event-emitter.mdx b/docs/platforms/javascript/guides/nestjs/features/event-emitter.mdx new file mode 100644 index 00000000000000..eb381e5f0f31fd --- /dev/null +++ b/docs/platforms/javascript/guides/nestjs/features/event-emitter.mdx @@ -0,0 +1,18 @@ +--- +title: NestJS Event Emitter +description: "Learn about instrumenting NestJS event-based services." +--- + + + The @nestjs/event-emitter module is auto-instrumented in `@sentry/nestjs` 8.39.0 and up. + + +The NestJS SDK wraps the `@OnEvent` decorator automatically to: + +- Create performance traces for event handler executions. +- Automatically capture any unhandled exceptions that occur in event handlers. +- Maintain visibility into asynchronous event-driven flows. + +When an event handler is executed, a new span is created to track its performance, and any errors are automatically reported to Sentry while preserving the original error behavior. + +This instrumentation works transparently with existing NestJS event handlers without requiring any code changes to your application. \ No newline at end of file diff --git a/platform-includes/getting-started-config/javascript.nestjs.mdx b/platform-includes/getting-started-config/javascript.nestjs.mdx index f251262e7edce3..3d8b8b3531c49f 100644 --- a/platform-includes/getting-started-config/javascript.nestjs.mdx +++ b/platform-includes/getting-started-config/javascript.nestjs.mdx @@ -1,8 +1,8 @@ -```javascript {tabTitle:CommonJS} {filename: instrument.js} {"onboardingOptions": {"performance": "11-14", "profiling": "2, 7-10, 15-18"}} -const Sentry = require("@sentry/nestjs"); -const { nodeProfilingIntegration } = require("@sentry/profiling-node"); +```javascript {tabTitle:ESM} {filename: instrument.mjs} {"onboardingOptions": {"performance": "11-14", "profiling": "2, 7-10, 15-18"}} +import * as Sentry from "@sentry/nestjs"; +import { nodeProfilingIntegration } from '@sentry/profiling-node'; -// Ensure to call this before requiring any other modules! +// Ensure to call this before importing any other modules! Sentry.init({ dsn: "___PUBLIC_DSN___", integrations: [ @@ -20,11 +20,11 @@ Sentry.init({ }); ``` -```javascript {tabTitle:ESM} {filename: instrument.mjs} {"onboardingOptions": {"performance": "11-14", "profiling": "2, 7-10, 15-18"}} -import * as Sentry from "@sentry/nestjs"; -import { nodeProfilingIntegration } from '@sentry/profiling-node'; +```javascript {tabTitle:CommonJS} {filename: instrument.js} {"onboardingOptions": {"performance": "11-14", "profiling": "2, 7-10, 15-18"}} +const Sentry = require("@sentry/nestjs"); +const { nodeProfilingIntegration } = require("@sentry/profiling-node"); -// Ensure to call this before importing any other modules! +// Ensure to call this before requiring any other modules! Sentry.init({ dsn: "___PUBLIC_DSN___", integrations: [ @@ -41,3 +41,4 @@ Sentry.init({ profilesSampleRate: 1.0, }); ``` + diff --git a/platform-includes/getting-started-use/javascript.nestjs.mdx b/platform-includes/getting-started-use/javascript.nestjs.mdx index bcea5e910ef9c6..ba5c937d25881b 100644 --- a/platform-includes/getting-started-use/javascript.nestjs.mdx +++ b/platform-includes/getting-started-use/javascript.nestjs.mdx @@ -49,6 +49,7 @@ export class YourCatchAllExceptionFilter implements ExceptionFilter { } ``` + {/* TODO(v9): Remove this note */} _Note that `@SentryExceptionCaptured()` was called `@WithSentry` in SDK versions `8.38.0` and prior._ @@ -72,7 +73,6 @@ import { SentryGlobalFilter } from "@sentry/nestjs/setup"; }) export class AppModule {} ``` - {/* TODO(v9): Remove this note. */} **Note:** If you have a NestJS + GraphQL application and you are using the `@sentry/nestjs` SDK version `8.38.0` or earlier, replace the `SentryGlobalFilter` with the `SentryGlobalGenericFilter`.