Absinthe plugin that captures timing information and injects response metadata.
Usage
Add this plugin to your schema:
defmodule MyApp.Schema do
use Absinthe.Schema
use AshGraphql, domains: [...], response_metadata: true
def plugins do
[AshGraphql.Plugin.ResponseMetadata | Absinthe.Plugin.defaults()]
end
end
Summary
Functions
Records end time for duration calculation.
Records start time for duration calculation.
Conditionally adds the metadata injection phase to the pipeline.
Functions
Records end time for duration calculation.
Stores System.monotonic_time() in execution.acc[:ash_graphql][:end_time].
Always overwrites (captures the latest resolution end).
Records start time for duration calculation.
Stores System.monotonic_time() in execution.acc[:ash_graphql][:start_time].
Only sets the value if not already present (idempotent).
Conditionally adds the metadata injection phase to the pipeline.
If the schema has response_metadata enabled, prepends
AshGraphql.Phase.InjectMetadata to process the captured timing data.