Skip to content

Commit

Permalink
Add Prisma ORM Integration Docs. (#4961)
Browse files Browse the repository at this point in the history
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
  • Loading branch information
onurtemizkan and imatwawana authored May 30, 2022
1 parent 7ae7244 commit 3938178
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
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 })],
});
```

0 comments on commit 3938178

Please sign in to comment.