Opt-in

(Available from 7.0.0)

Sentry supports tracing Prisma ORM 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:

Copied
import { PrismaClient } from "@prisma/client";
import * as Sentry from "@sentry/node";

const client = new PrismaClient();

Sentry.init({
  dsn: https://examplePublicKey@o0.ingest.sentry.io/0,
  release: "1.0",
  tracesSampleRate: 1.0,
  integrations: [new Sentry.Integrations.Prisma({ client })],
});

(Available from 7.2.0)

Sentry supports the tracing GraphQL execution process with an opt-in tracing integration. It creates a db.graphql transaction for each GraphQL process that may contain one or more resolvers.

This integration doesn't work on the resolver level, but instead provides a single transaction that covers the whole execution of a GraphQL process. If you use Apollo Server to define your GraphQL resolvers, Sentry's Apollo Server integration can be combined with this integration to get more precise resolver-level hierarchical tracing data.

For example:

Copied
import * as Sentry from "@sentry/node";

Sentry.init({
  tracesSampleRate: 1.0,
  integrations: [new Sentry.Integrations.GraphQL()],
});

(Available from 7.2.0)

Sentry provides an opt-in tracing integration for Apollo resolvers. It supports nested resolvers, and also works well with the other @sentry/node database tracing integrations when there are database operations inside resolvers.

The Apollo integration creates db.graphql.apollo spans for each resolver and reports to Sentry with a description containing the resolver's name and group:

Copied
import * as Sentry from "@sentry/node";

Sentry.init({
  tracesSampleRate: 1.0,
  integrations: [new Sentry.Integrations.Apollo()],
});

If you use NestJs, initialize the integration with the useNestjs option

Copied
new Sentry.Integrations.Apollo({ useNestjs: true });

Known Limitation: This integration does not support Apollo servers where the schema was loaded using the schema property (new ApolloServer({ schema: ... })).

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").