diff --git a/lib/absinthe/phase/document/execution/resolution.ex b/lib/absinthe/phase/document/execution/resolution.ex index 89aabbd3..6119a426 100644 --- a/lib/absinthe/phase/document/execution/resolution.ex +++ b/lib/absinthe/phase/document/execution/resolution.ex @@ -6,9 +6,6 @@ defmodule Absinthe.Phase.Document.Execution.Resolution do # Blueprint results are placed under `blueprint.result.execution`. This is # because the results form basically a new tree from the original blueprint. - @middleware_start [:absinthe, :middleware, :call, :start] - @middleware_stop [:absinthe, :middleware, :call, :stop] - alias Absinthe.{Blueprint, Type, Phase} alias Blueprint.{Result, Execution} @@ -234,17 +231,15 @@ defmodule Absinthe.Phase.Document.Execution.Resolution do defp reduce_resolution(%{middleware: []} = res), do: res defp reduce_resolution(%{middleware: [middleware | remaining_middleware]} = res) do - metadata = %{middleware: middleware, resolution: res} - :telemetry.execute(@middleware_start, %{system_time: System.system_time()}, metadata) - - res = - case call_middleware(middleware, %{res | middleware: remaining_middleware}) do - %{state: :suspended} = res -> res - res -> reduce_resolution(res) - end + :telemetry.span [:absinthe, :middleware, :call], %{middleware: middleware, resolution: res}, fn -> + result = + case call_middleware(middleware, %{res | middleware: remaining_middleware}) do + %{state: :suspended} = res -> res + res -> reduce_resolution(res) + end - :telemetry.execute(@middleware_stop, %{system_time: System.system_time()}, metadata) - res + {result, %{middewlare: middleware, resolution: res}} + end end defp call_middleware({{mod, fun}, opts}, res) do diff --git a/lib/absinthe/pipeline.ex b/lib/absinthe/pipeline.ex index 740c5737..e77d857f 100644 --- a/lib/absinthe/pipeline.ex +++ b/lib/absinthe/pipeline.ex @@ -14,8 +14,8 @@ defmodule Absinthe.Pipeline do alias Absinthe.Phase - @phase_start [:absinthe, :phase, :run, :start] - @phase_stop [:absinthe, :phase, :run, :stop] + # @phase_start [:absinthe, :phase, :run, :start] + # @phase_stop [:absinthe, :phase, :run, :stop] @type data_t :: any @@ -414,11 +414,7 @@ defmodule Absinthe.Pipeline do run_phase(todo, result, [phase | done]) {:ok, result} -> - metadata = %{phase: phase, options: options} - :telemetry.execute(@phase_start, %{system_time: System.system_time()}, metadata) - result = run_phase(todo, result, [phase | done]) - :telemetry.execute(@phase_stop, %{system_time: System.system_time()}, metadata) - result + run_phase(todo, result, [phase | done]) {:jump, result, destination_phase} when is_atom(destination_phase) -> run_phase(from(todo, destination_phase), result, [phase | done])