py_gql.tracers#

Collection of useful tracers implementations.

class py_gql.tracers.TimingTracer[source]#

Bases: py_gql.execution.instrumentation.Instrumentation

Default implementation for tracers that collect GraphQL execution timing using the datetime module. All times are collected as UTC.

on_query()[source]#

This will be called at the very start of query processing.

The returned callback will be called immediatly before the execution result is returned to the caller.

on_execution()[source]#

This will be called before operation execution starts.

The returned callback will be called after operation execution ends.

on_parse()[source]#

This will be called just before the request document is parsed. It will not be called when the execution code is provided an already parsed ast.

The returned callback will be called immediatly after the document has been parsed wether parsing was successful or not.

on_validate()[source]#

This will be called before query validation.

The returned callback will be called immediatly after the document has been validated wether parsing was successful or not.

on_field(_root, _ctx, info)[source]#

This will be called before field execution starts.

The returned callback will be called after field execution ends and before field completion starts.

class py_gql.tracers.ApolloTracer[source]#

Bases: py_gql.tracers.TimingTracer, py_gql.execution.wrappers.GraphQLExtension

Tracer implementation compatible with the Apollo Tracing specification.

This tracers also implements py_gql.GraphQLExtension in order to be included in the response according to the specification.

payload()[source]#

Returns: Any: Extension payload; must be JSON serialisable.