diff --git a/src/platforms/node/common/performance/database/index.mdx b/src/platforms/node/common/performance/database/index.mdx index 6f802da2c5541..6c7d91bc460a3 100644 --- a/src/platforms/node/common/performance/database/index.mdx +++ b/src/platforms/node/common/performance/database/index.mdx @@ -17,6 +17,9 @@ Auto-instrumented: Opt-in: - [Prisma ORM](https://www.prisma.io/) _Available from version 7.0.0_ +- [GraphQL](https://graphql.org/graphql-js/) _Available from version _ +- [Apollo Server](https://www.apollographql.com/docs/apollo-server/) _Available from version _ + ## Next Steps diff --git a/src/platforms/node/common/performance/database/opt-in.mdx b/src/platforms/node/common/performance/database/opt-in.mdx index fcc79f1e7b3a2..b6fd8c921e41a 100644 --- a/src/platforms/node/common/performance/database/opt-in.mdx +++ b/src/platforms/node/common/performance/database/opt-in.mdx @@ -26,4 +26,43 @@ Sentry.init({ tracesSampleRate: 1.0, integrations: [new Tracing.Integrations.Prisma({ client })], }); -``` \ No newline at end of file +``` + +## GraphQL Integration + +_(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: + +```javascript +import * as Sentry from '@sentry/node'; +import * as Tracing from '@sentry/tracing'; + +Sentry.init({ + tracesSampleRate: 1.0, + integrations: [new Tracing.Integrations.GraphQL()], +}); +``` + +## Apollo Server Integration + +_(Available from `7.2.0`)_ + +Sentry provides an opt-in tracing integration for [Apollo resolvers](https://www.apollographql.com/docs/apollo-server/data/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: + +```javascript +import * as Sentry from '@sentry/node'; +import * as Tracing from '@sentry/tracing'; + +Sentry.init({ + tracesSampleRate: 1.0, + integrations: [new Tracing.Integrations.Apollo()], +}); +```