Tracing

Apollo

To enable Apollo tracing you can use the ApolloTracingExtension provided:

from strawberry.extensions.tracing import ApolloTracingExtension
schema = strawberry.Schema(query=Query, extensions=[ApolloTracingExtension])

Note that if you're not running under ASGI you'd need to use the sync version of ApolloTracingExtension:

from strawberry.extensions.tracing import ApolloTracingExtensionSync
schema = strawberry.Schema(query=Query, extensions=[ApolloTracingExtensionSync])

Open Telemetry

In addition to Apollo Tracing we also support opentelemetry, using the OpenTelemetryExtension.

You also need to install the extras for opentelemetry by doing:

pip install 'strawberry-graphql[opentelemetry]'
from strawberry.extensions.tracing import OpenTelemetryExtension
schema = strawberry.Schema(query=Query, extensions=[OpenTelemetryExtension])

Note that if you're not running under ASGI you'd need to use the sync version of OpenTelemetryExtension:

from strawberry.extensions.tracing import OpenTelemetryExtensionSync
schema = strawberry.Schema(query=Query, extensions=[OpenTelemetryExtensionSync])

Was this helpful?

Edit on Github

Newsletter 💌

Do you want to receive the latest updates on Strawberry? Subscribe to our newsletter!