Ariadne 0.20
Ariadne 0.20 has been released!
This release removes support for Python 3.7, adds Open Telemetry extension, deprecates Open Tracing and Apollo Tracing extensions.
It also includes bugfixes, new configuration options and updated GraphQL extensions that should perform better than previous ones in asynchronous servers.
Dropped Python 3.7 support
Python 3.7 reaches end of life on 27 June 2023, but we are already experiencing some of Ariadne's tests failing for it due to the dependencies being ahead of us in dropping support.
Ariadne 0.20 drops support for Python 3.7. It may still work on Python 3.7, we will not test against it anymore and bugs and crashes specific to it will not be addressed.
New extensions implementation
Note: This is a breaking change. See the middleware document for new guide for developers.
In the past Ariadne shipped with both synchronous and asynchronous GraphQL extensions. Our users reported that asynchronous extensions suffered from performance issues, which we've attempted to resolve together with the community through extra configuration options enabling exclusion of specified fields from tracing, but this didn't lead to noticeable improvements.
We've received an important tip from Christoph Zwerschke, developer of the GraphQL-core 3
library which powers Ariadne's GraphQL implementation. In short, using asynchronous middleware resulted in every GraphQL field becoming asynchronous, even those excluded from tracing. Async/await in Python is generally fast enough, but it's overhead is non-negligible, especially for thousands of calls that happen during GraphQL query execution.
Ariadne 0.20 adds a benchmarks suite to the project. This suite allowed us to measure the performance hit on no-op asynchronous GraphQL extension (around 1.66 times slower than baseline query execution on Python 3.11).
In this release we have also dropped separate implementations for asynchronous and synchronous extensions. Ariadne's GraphQL extensions are now always synchronous, but in scenarios where the GraphQL resolver or its return value is asynchronous, those extensions return asynchronous closure for GraphQL's query executor to evaluate.
Quick results from last benchmarks are:
- 1x: GraphQL query execution without any extensions enabled.
- 1.1x slower: GraphQL query execution with single no-op extension enabled.
- 1.31x slower: GraphQL query execution with single extension enabled, using the
OpenTelemetry
extension.
We are happy with those gains and hope that our community will share our optimism at this change, even if the extensions system becomes more complex for extension developers.
Documentation for extensions and middleware was updated accordingly to explain the performance pitfall of using async extensions and new way to implement extensions that support both async and sync resolvers.
Migrating existing projects to new extensions
To update your project to use new extensions:
- replace
OpenTracingSync
withOpenTracing
. - replace
opentracing_extension_sync
withopentracing_extension
. - replace
ApolloTracingSync
withApolloTracing
.
ExtensionSync
base class was also removed from Ariadne. Please use Extension
as base class for custom extensions. See the middleware document for the guide for new middlewares what support both async and sync execution.
Deprecated Open Tracing and Apollo Tracing
The Open Tracing standard has been deprecated and is superseded by the Open Telemetry.
Apollo Tracing was deprecated by Apollo, with new a APM solution available but not supported by Ariadne.
Both of those extensions will be dropped in future release of Ariadne.
New features
Ariadne's ASGI
and WSGI
applications now implement new query_validator
option that enables customization of GraphQL query validation process.
Added OpenTelemetry
and opentelemetry_extension
extensions for enabling the Open Telemetry APM for GraphQL servers. Those are importable from ariadne.tracing.opentelemetry
.
Bugs fixed
Fixed ERROR
message in GraphQL-WS protocol having invalid payload type. This error occurred in a limited number of cases but was still a pain point for scenarios where Ariadne was used for GraphQL subscriptions.
Ariadne's GraphQL query cost validator did not handle the inline fragments. This was reported and fixed by our amazing friends at Saleor!
make_executable_schema
would raise an error if GraphQL SDL passed to it contained field(arg: InputType = null)
. This was corrected.
GraphiQL2's default template shipped with Ariadne used development builds of React.js. This template was updated to use production builds instead.
Changelog
- Dropped support for Python 3.7.
- Added
OpenTelemetry
andopentelemetry_extension
extension, importable formariadne.tracing.opentelemetry
. - Added
query_validator
option to ASGI and WSGIGraphQL
applications that enables customization of query validation step. - Fixed
ERROR
message in GraphQL-WS protocol having invalid payload type. - Fixed query cost validator incorrect handling of inline fragments.
- Fixed
make_executable_schema
error whennull
is used as default value forinput
typed field argument. - Updated default GraphiQL2 template to use production build of React.js.
- Removed
ExtensionSync
.Extension
now supports both async and sync contexts. - Removed
OpenTracingSync
andopentracing_extension_sync
.OpenTracing
andopentracing_extension
now support both async and sync contexts. - Removed
ApolloTracingSync
.ApolloTracing
now supports both async and sync contexts.