GQL

GQL GraphQL client integration

The GQL integration allows you to monitor all GraphQL requests that your Python application makes using the gql library. Specifically, this integration reports every TransportQueryError to Sentry and provides additional context including:

  • The URL the request was made to
  • The GraphQL query which caused the error
  • The errors information that the GraphQL server returns

Make sure you have the latest version of the Sentry SDK installed:

Copied
pip install --upgrade sentry-sdk

If you have the gql package in your dependencies, the GQL integration will be enabled automatically when you initialize the Sentry SDK.

To ensure data privacy, the SDK avoids sending any information that may potentially contain personally identifiable information (PII) by default. See the docs for the send_default_pii flag for more information.

For the GQL integration, this policy means that the SDK doesn't send the GraphQL queries and the errors information that the GraphQL server returns, unless you override the default configuration via the send_default_pii flag.

To have Sentry record the GraphQL queries and the errors information returned by the GraphQL server, add the following to your SDK init:

Copied
sentry_sdk.init(
    # ...
    send_default_pii=True,
)
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").