---
title: "Ariadne"
description: "Learn about importing the Ariadne GraphQL integration and how it captures GraphQL errors."
url: https://docs.sentry.io/platforms/python/integrations/ariadne/
---

# Ariadne | Sentry for Python

The Ariadne integration captures errors from the [Ariadne GraphQL library](https://ariadnegraphql.org/), which can then be viewed in [Sentry](https://sentry.io).

## [Install](https://docs.sentry.io/platforms/python/integrations/ariadne.md#install)

To get started, install `sentry-sdk` from PyPI.

```bash
pip install "sentry-sdk"
```

## [Configure](https://docs.sentry.io/platforms/python/integrations/ariadne.md#configure)

If you have the `ariadne` package in your dependencies, the Ariadne integration will be enabled automatically when you initialize the Sentry SDK.

Error Monitoring\[ ]Tracing\[ ]Profiling\[ ]Logs

```python
import sentry_sdk

sentry_sdk.init(
    dsn="___PUBLIC_DSN___",
    # Add data like request headers and IP for users, if applicable;
    # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
    send_default_pii=True,
    # ___PRODUCT_OPTION_START___ performance
    # Set traces_sample_rate to 1.0 to capture 100%
    # of transactions for tracing.
    traces_sample_rate=1.0,
    # ___PRODUCT_OPTION_END___ performance
    # ___PRODUCT_OPTION_START___ profiling
    # To collect profiles for all profile sessions,
    # set `profile_session_sample_rate` to 1.0.
    profile_session_sample_rate=1.0,
    # Profiles will be automatically collected while
    # there is an active span.
    profile_lifecycle="trace",
    # ___PRODUCT_OPTION_END___ profiling
    # ___PRODUCT_OPTION_START___ logs

    # Enable logs to be sent to Sentry
    enable_logs=True,
    # ___PRODUCT_OPTION_END___ logs
)
```

## [Verify](https://docs.sentry.io/platforms/python/integrations/ariadne.md#verify)

Create a file called `app.py` with the following contents:

```python
from ariadne import QueryType, gql, make_executable_schema
from ariadne.asgi import GraphQL

sentry_sdk.init(...)  # same as above

type_defs = gql(
    """
    type Query {
        hello: String!
    }
"""
)

query = QueryType()

@query.field("hello")
def resolve_hello(*_):
    1 / 0
    return "Hello!"

schema = make_executable_schema(type_defs, query)
app = GraphQL(schema, debug=True)
```

Make sure you have `uvicorn` installed:

```bash
pip install uvicorn
```

And finally run your GraphQL web server with:

```bash
uvicorn app:app
```

Open <http://127.0.0.1:8000> in your browser. You should see the GraphiQL graphical user interface.

Enter `{ hello }` into the query field then press the "Execute query" button. Your web app will be queried and will encounter the `ZeroDivisionError` error we've snuck into the `resolve_hello` resolver function.

This will create a corresponding `GraphQLError` in the Issues section of [sentry.io](https://sentry.io). It will take a couple of moments for the data to appear in [Sentry](https://sentry.io).

## [Options](https://docs.sentry.io/platforms/python/integrations/ariadne.md#options)

The Ariadne integration can capture request and response payload for each GraphQL error that happens. Since these may contain sensitive data, the SDK needs to be initialized with the [send\_default\_pii](https://docs.sentry.io/platforms/python/configuration/options.md#send-default-pii) option set to `True`.

By default, no request and response data will be attached.

```python
sentry_sdk.init(
    # same options as above
    send_default_pii=True,
)
```

##### Note

Since `send_default_pii` is a global SDK option, setting it to `True` will affect all integrations, not just Ariadne. Please make sure to [scrub sensitive data](https://docs.sentry.io/platforms/python/data-management/sensitive-data.md) from events before enabling this option.

## [Supported Versions](https://docs.sentry.io/platforms/python/integrations/ariadne.md#supported-versions)

* ariadne: 0.20+
* Python: 3.8+
