---
title: "GraphQL"
description: "Adds instrumentation for GraphQL. (default)"
url: https://docs.sentry.io/platforms/javascript/guides/remix/configuration/integrations/graphql/
---

# GraphQL | Sentry for Remix

This integration only works in the Node.js and Bun runtimes.

*Import name: `Sentry.graphqlIntegration`*

This integration is enabled by default when performance monitoring is enabled. If you'd like to modify your default integrations, read [this](https://docs.sentry.io/platforms/javascript/guides/remix/configuration/integrations.md#modifying-default-integrations).

The `graphqlIntegration` adds instrumentation for the `graphql` library to capture spans using [`@opentelemetry/instrumentation-graphql`](https://www.npmjs.com/package/@opentelemetry/instrumentation-graphql).

```JavaScript
Sentry.init({
  integrations: [Sentry.graphqlIntegration()],
});
```

## [Supported Versions](https://docs.sentry.io/platforms/javascript/guides/remix/configuration/integrations/graphql.md#supported-versions)

* `graphql`: `>=14.0.0 <17`

## [Options](https://docs.sentry.io/platforms/javascript/guides/remix/configuration/integrations/graphql.md#options)

### [`ignoreResolveSpans`](https://docs.sentry.io/platforms/javascript/guides/remix/configuration/integrations/graphql.md#ignoreresolvespans)

*Type: `boolean`*

If spans for resolver functions should not be created. Default is `true`.

### [`ignoreTrivialResolveSpans`](https://docs.sentry.io/platforms/javascript/guides/remix/configuration/integrations/graphql.md#ignoretrivialresolvespans)

*Type: `boolean`*

If spans for the execution of the default resolver on object properties should not be created. Default is `true`.

When a resolver function is not defined on the schema for a field, GraphQL will use the default resolver which just looks for a property with that name on the object. If the property is not a function, it's not very interesting to trace. This option can reduce noise and number of spans created.

### [`useOperationNameForRootSpan`](https://docs.sentry.io/platforms/javascript/guides/remix/configuration/integrations/graphql.md#useoperationnameforrootspan)

*Type: `boolean`*

By default, this option is `true`. When enabled, it records GraphQL operations on the enclosing root span in the `sentry.graphql.operation` attribute. Its effect on the root span name depends on the tracing mode:

* In streaming mode, the root span name stays unchanged. Set the option to `false` to skip adding `sentry.graphql.operation` to the root span.

* In static mode, with `traceLifecycle: "static"`, enabling this option also appends operation names to the `http.server` root span name. For example, `POST /graphql` becomes `POST /graphql (query MyQuery)`. Requests containing multiple operations include each operation name, such as `POST /graphql (query Query1, query Query2)`. Set the option to `false` to skip the root span attribute and preserve the original root span name.

In both modes, the GraphQL span records `graphql.operation.name` and `graphql.operation.type` when available, regardless of this option.
