Skip to content

Commit 5d6b7ca

Browse files
onurtemizkanimatwawana
authored andcommitted
Add Prisma ORM Integration Docs. (#4961)
Co-authored-by: Isabel <[email protected]>
1 parent d6f0151 commit 5d6b7ca

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

src/platforms/node/common/performance/database.mdx renamed to src/platforms/node/common/performance/database/auto-instrument.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Database integrations
2+
title: Auto-instrumented
33
---
44

55
Node.js integrations support tracking database queries as spans. Starting in version `6.4.0`, `@sentry/tracing` will auto-detect supported database drivers or ORMs being used in your project, and automatically enable the relevant integrations with default options - without needing additional code.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Database Integrations
3+
---
4+
5+
Node.js integrations support tracking database queries as spans.
6+
7+
## Supported Platforms
8+
9+
Auto-instrumented:
10+
11+
- `pg` (Postgres)
12+
- `pg-native` (Postgres) _Available from version 6.12.0_
13+
- `mongodb` (Mongo)
14+
- `mongoose` (Mongo)
15+
- `mysql` (MySQL)
16+
17+
Opt-in:
18+
19+
- [Prisma ORM](https://www.prisma.io/) _Available from version 7.0.0_
20+
21+
## Next Steps
22+
23+
<PageGrid />
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Opt-in
3+
---
4+
5+
## Prisma ORM Integration
6+
7+
_(Available from `7.0.0`)_
8+
9+
Sentry supports tracing [Prisma ORM](https://www.prisma.io/) fetchers with Prisma integration. This integration is an opt-in feature and requires that a `PrismaClient` instance is provided.
10+
11+
Prisma integration creates a `db.prisma` span for each query and reports to Sentry with relevant details inside `description` if available.
12+
13+
For example:
14+
15+
```javascript
16+
import { PrismaClient } from '@prisma/client';
17+
import * as Sentry from '@sentry/node';
18+
import * as Tracing from '@sentry/tracing';
19+
import { randomBytes } from 'crypto';
20+
21+
const client = new PrismaClient();
22+
23+
Sentry.init({
24+
dsn: ___PUBLIC_DSN___,
25+
release: '1.0',
26+
tracesSampleRate: 1.0,
27+
integrations: [new Tracing.Integrations.Prisma({ client })],
28+
});
29+
```

0 commit comments

Comments
 (0)