Tapper Absinthe Plug v0.2.1 Tapper.Plug.Absinthe View Source

Works in concert with Tapper.Plug.Trace to propagate the Tapper Id into the Absinthe context.

You can then access the Tapper id via a resolver’s info (%Absinthe.Resolution{}) parameter, using this modules’ get/1 function.

In your router:

plug Tapper.Plug.Trace # pick up the trace
plug Tapper.Plug.Absinthe # copy the id into the Absinthe context

In your resolver:

def resolve(args, info) do
  # pick up from id info.context
  tapper_id = Tapper.Plug.Absinthe.get(info)

  tapper_id = Tapper.start_span(id, name: "my-resolver") # etc.
  ...
  Tapper.finish_span(tapper_id)
end

Link to this section Summary

Functions

Callback implementation for Plug.call/2

Get the tapper id from the Absinthe Resolution info if present, or return :ignore

Callback implementation for Plug.init/1

Link to this section Functions

Link to this function call(conn, config) View Source
call(conn :: Plug.Conn.t(), config :: any()) :: Plug.Conn.t()

Callback implementation for Plug.call/2.

Link to this function get(info) View Source
get(resolution :: %Absinthe.Resolution{acc: term(), adapter: term(), arguments: term(), context: term(), definition: term(), errors: term(), extensions: term(), middleware: term(), parent_type: term(), path: term(), private: term(), root_value: term(), schema: term(), source: term(), state: term(), value: term()} | map()) :: Tapper.Id.t()

Get the tapper id from the Absinthe Resolution info if present, or return :ignore.

Callback implementation for Plug.init/1.