From 5e8656ddb7662f701ac0cc3caa8248ce2fb32cb3 Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Mon, 30 May 2022 14:10:51 +0000 Subject: [PATCH 1/3] Add Node Apollo and GraphQL Integrations --- .../common/performance/database/index.mdx | 3 ++ .../common/performance/database/opt-in.mdx | 41 ++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/platforms/node/common/performance/database/index.mdx b/src/platforms/node/common/performance/database/index.mdx index 6f802da2c55414..6c7d91bc460a3d 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 fcc79f1e7b3a29..79974141e7908f 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.0.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. + +Example usage: + +```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.0.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 `@sentry/node`'s other 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()], +}); +``` From b6c3a2eda97dd069df23631c6a95e911989c86d3 Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Mon, 6 Jun 2022 13:58:48 +0100 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --- src/platforms/node/common/performance/database/opt-in.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platforms/node/common/performance/database/opt-in.mdx b/src/platforms/node/common/performance/database/opt-in.mdx index 79974141e7908f..3ab9b2acc70e80 100644 --- a/src/platforms/node/common/performance/database/opt-in.mdx +++ b/src/platforms/node/common/performance/database/opt-in.mdx @@ -37,7 +37,7 @@ Sentry supports the tracing GraphQL execution process with an opt-in tracing int 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. -Example usage: +For example: ```javascript import * as Sentry from '@sentry/node'; @@ -53,7 +53,7 @@ Sentry.init({ _(Available from `7.0.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 `@sentry/node`'s other database tracing integrations, when there are database operations inside resolvers. +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: From 7274a798c8f0e2f406600764cf7c28b750a96e62 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 20 Jun 2022 11:59:54 -0400 Subject: [PATCH 3/3] Apply suggestions from code review --- src/platforms/node/common/performance/database/opt-in.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platforms/node/common/performance/database/opt-in.mdx b/src/platforms/node/common/performance/database/opt-in.mdx index 3ab9b2acc70e80..b6fd8c921e41a7 100644 --- a/src/platforms/node/common/performance/database/opt-in.mdx +++ b/src/platforms/node/common/performance/database/opt-in.mdx @@ -30,7 +30,7 @@ Sentry.init({ ## GraphQL Integration -_(Available from `7.0.0`)_ +_(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. @@ -51,7 +51,7 @@ Sentry.init({ ## Apollo Server Integration -_(Available from `7.0.0`)_ +_(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.