Prisma

Adds instrumentation for Prisma.

Import name: Sentry.prismaIntegration

Sentry supports tracing Prisma ORM queries with the Prisma integration.

The Prisma Integrations creates a spans for each query and reports to Sentry with relevant details inside thedescription if available.

To use the integration with Prisma version 6, add the prismaIntegration to your Sentry initialization as follows:

Copied
Sentry.init({
  tracesSampleRate: 1.0,
  integrations: [Sentry.prismaIntegration()],
});

To configure the integration for Prisma version 5, first add the tracing feature flag to the generator block of your Prisma schema:

schema.prisma
Copied
generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["tracing"]
}

For Prisma version 5 compatibility you must pass a specific version of the Prisma instrumentation to the Sentry Prisma integration. Add the prismaIntegration to your Sentry initialization as follows:

Copied
import { PrismaInstrumentation } from "@prisma/instrumentation";

Sentry.init({
  tracesSampleRate: 1.0,
  integrations: [
    Sentry.prismaIntegration({
      // Override the default instrumentation that Sentry uses
      prismaInstrumentation: new PrismaInstrumentation(),
    }),
  ],
});

Type: Instrumentation (An OpenTelemetry type)

Overrides the instrumentation used by the Sentry SDK with the passed in instrumentation instance.

  • prisma: >=5
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").