Skip to content

Commit 5ceda8b

Browse files
authored
[v9] Add v9 docs for prisma integration (#12541)
1 parent 889ef7e commit 5ceda8b

File tree

3 files changed

+106
-20
lines changed

3 files changed

+106
-20
lines changed

docs/platforms/javascript/common/configuration/integrations/prisma.mdx

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,22 @@ _Import name: `Sentry.prismaIntegration`_
3232

3333
Sentry supports tracing [Prisma ORM](https://www.prisma.io/) queries with the Prisma integration.
3434

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

3737
## Prisma Version 6
3838

39-
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.
40-
41-
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).
42-
43-
Then, add the `prismaIntegration` to your Sentry initialization as follows:
44-
45-
```javascript {1,6-9}
46-
import { PrismaInstrumentation } from "@prisma/instrumentation";
39+
To use the integration with Prisma version 6, add the `prismaIntegration` to your Sentry initialization as follows:
4740

41+
```javascript {3}
4842
Sentry.init({
4943
tracesSampleRate: 1.0,
50-
integrations: [
51-
Sentry.prismaIntegration({
52-
// Override the default instrumentation that Sentry uses
53-
prismaInstrumentation: new PrismaInstrumentation(),
54-
}),
55-
],
44+
integrations: [Sentry.prismaIntegration()],
5645
});
5746
```
5847

5948
## Prisma Version 5
6049

61-
To install the integration for Prisma version 5, first enable the `tracing` feature flag in the `generator` block of your Prisma schema:
50+
To configure the integration for Prisma version 5, first add the `tracing` feature flag to the `generator` block of your Prisma schema:
6251

6352
```txt {tabTitle: Prisma Schema} {filename: schema.prisma} {3}
6453
generator client {
@@ -67,12 +56,19 @@ generator client {
6756
}
6857
```
6958

70-
Then, add the `prismaIntegration` to your Sentry initialization as follows:
59+
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:
60+
61+
```javascript {1,6-9}
62+
import { PrismaInstrumentation } from "@prisma/instrumentation";
7163

72-
```javascript {3}
7364
Sentry.init({
7465
tracesSampleRate: 1.0,
75-
integrations: [Sentry.prismaIntegration()],
66+
integrations: [
67+
Sentry.prismaIntegration({
68+
// Override the default instrumentation that Sentry uses
69+
prismaInstrumentation: new PrismaInstrumentation(),
70+
}),
71+
],
7672
});
7773
```
7874

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
title: Prisma
3+
description: "Adds instrumentation for Prisma."
4+
noindex: true # Not indexed because it is a versioned docs page
5+
supported:
6+
- javascript.node
7+
- javascript.aws-lambda
8+
- javascript.azure-functions
9+
- javascript.connect
10+
- javascript.express
11+
- javascript.fastify
12+
- javascript.gcp-functions
13+
- javascript.hapi
14+
- javascript.koa
15+
- javascript.nestjs
16+
- javascript.nextjs
17+
- javascript.nuxt
18+
- javascript.solidstart
19+
- javascript.sveltekit
20+
- javascript.remix
21+
- javascript.react-router
22+
- javascript.astro
23+
- javascript.bun
24+
---
25+
26+
<Alert>
27+
28+
This integration only works in the Node.js and Bun runtimes.
29+
30+
</Alert>
31+
32+
_Import name: `Sentry.prismaIntegration`_
33+
34+
Sentry supports tracing [Prisma ORM](https://www.prisma.io/) queries with the Prisma integration.
35+
36+
The Prisma Integrations creates a spans for each query and reports to Sentry with relevant details inside `description` if available.
37+
38+
## Prisma Version 6
39+
40+
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.
41+
42+
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).
43+
44+
Then, add the `prismaIntegration` to your Sentry initialization as follows:
45+
46+
```javascript {1,6-9}
47+
import { PrismaInstrumentation } from "@prisma/instrumentation";
48+
49+
Sentry.init({
50+
tracesSampleRate: 1.0,
51+
integrations: [
52+
Sentry.prismaIntegration({
53+
// Override the default instrumentation that Sentry uses
54+
prismaInstrumentation: new PrismaInstrumentation(),
55+
}),
56+
],
57+
});
58+
```
59+
60+
## Prisma Version 5
61+
62+
To configure the integration for Prisma version 5, first add the `tracing` feature flag to the `generator` block of your Prisma schema:
63+
64+
```txt {tabTitle: Prisma Schema} {filename: schema.prisma} {3}
65+
generator client {
66+
provider = "prisma-client-js"
67+
previewFeatures = ["tracing"]
68+
}
69+
```
70+
71+
Then, add the `prismaIntegration` to your Sentry initialization as follows:
72+
73+
```javascript {3}
74+
Sentry.init({
75+
tracesSampleRate: 1.0,
76+
integrations: [Sentry.prismaIntegration()],
77+
});
78+
```
79+
80+
## Options
81+
82+
### `prismaInstrumentation`
83+
84+
_Type: `Instrumentation`_ (An OpenTelemetry type)
85+
86+
Overrides the instrumentation used by the Sentry SDK with the passed in instrumentation instance.
87+
88+
## Supported Versions
89+
90+
- `prisma`: `>=5`

docs/platforms/javascript/guides/aws-lambda/tracing/instrumentation/automatic-instrumentation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Database instrumentation can be manually enabled by adding the corresponding int
1919
- `mongo`
2020
- `mongoose`
2121
- `ioredis`
22-
- `prisma` (requires additional configuration - see <PlatformLink to="/configuration/integrations/prisma/">Prisma Integration</PlatformLink>)
22+
- `prisma` (requires additional configuration - see <PlatformLink to="/configuration/integrations/prisma">Prisma Integration</PlatformLink>)
2323

2424
You can add the integrations as follows:
2525

0 commit comments

Comments
 (0)