Skip to content

[JS v7] Add Prisma ORM Integration Docs. #4961

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 4 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
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
@@ -1,5 +1,5 @@
---
title: Database integrations
title: Auto-instrumented
---

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.
Expand Down
23 changes: 23 additions & 0 deletions src/platforms/node/common/performance/database/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Database Integrations
---

Node.js integrations support tracking database queries as spans.

## Supported Platforms

Auto-instrumented:

- `pg` (Postgres)
- `pg-native` (Postgres) _Available from version 6.12.0_
- `mongodb` (Mongo)
- `mongoose` (Mongo)
- `mysql` (MySQL)

Opt-in:

- [Prisma ORM](https://www.prisma.io/) _Available from version 7.0.0_

## Next Steps

<PageGrid />
29 changes: 29 additions & 0 deletions src/platforms/node/common/performance/database/opt-in.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Opt-in
---

## Prisma ORM Integration

_(Available from `7.0.0`)_

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.

Prisma integration creates a `db.prisma` span for each query and reports to Sentry with relevant details inside `description` if available.

For example:

```javascript
import { PrismaClient } from '@prisma/client';
import * as Sentry from '@sentry/node';
import * as Tracing from '@sentry/tracing';
import { randomBytes } from 'crypto';

const client = new PrismaClient();

Sentry.init({
dsn: ___PUBLIC_DSN___,
release: '1.0',
tracesSampleRate: 1.0,
integrations: [new Tracing.Integrations.Prisma({ client })],
});
```