Skip to content

Add instructions on how to support prisma v6 #12425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ supported:

<Alert>

This integration only works in the Node.js and Bun runtimes. This integration only supports Prisma v5 at the current time. If you're interested in Prisma v6 support, please leave your thoughts on the [Prisma v6 tracking issue for the Sentry SDK](https://github.com/getsentry/sentry-javascript/issues/14793).
This integration only works in the Node.js and Bun runtimes.

</Alert>

Expand All @@ -34,7 +34,31 @@ Sentry supports tracing [Prisma ORM](https://www.prisma.io/) queries with the Pr

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

To install the integration, first enable the `tracing` feature flag in the `generator` block of your Prisma schema:
## Prisma Version 6

The Sentry Prisma Integration comes with Prisma version 5 support by default. For Prisma version 6 compatibility we need to pass a specific version of the Prisma instrumentation to the Sentry Prisma integration.

To use the integration with Prisma version 6, first install the `@prisma/instrumentation` package on version 6 (ideally the exact same version as your `prisma` and `@prisma/client` packages).

Then, add the `prismaIntegration` to your Sentry initialization as follows:

```javascript {1,6-9}
import { PrismaInstrumentation } from "@prisma/instrumentation";

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

## Prisma Version 5

To install the integration for Prisma version 5, first enable the `tracing` feature flag in the `generator` block of your Prisma schema:

```txt {tabTitle: Prisma Schema} {filename: schema.prisma} {3}
generator client {
Expand All @@ -52,7 +76,14 @@ Sentry.init({
});
```

## Options

### `prismaInstrumentation`

_Type: `Instrumentation`_ (An OpenTelemetry type)

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

## Supported Versions

- `prisma`: `>=5 <6`
- `prisma`: `>=5`
Loading