SentryTraced Decorator

Learn about Sentry's SentryTraced decorator.

The @SentryTraced decorator is available from version @sentry/nestjs 8.15.0 and up.

The NestJS SDK includes a @SentryTraced decorator that will create spans whenever the method it decorates is invoked. This feature enables more granular performance monitoring and helps you gather detailed insights into the performance of individual functions within your application.

To get started import SentryTraced from @sentry/nestjs and use it to decorate a function of your choice:

Copied
import { SentryTraced } from "@sentry/nestjs";

export class MyService {
  @SentryTraced()
  myFunction() {
    // Your function logic here
  }
}
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").