Skip to content

Commit

Permalink
Merge pull request #3 from Frameio/cschiewek/GRAPH-924/phase-and-midd…
Browse files Browse the repository at this point in the history
…leware-telemetry-events

Middleware Telemetry Events.
  • Loading branch information
cschiewek authored Mar 18, 2024
2 parents 432e4e5 + 9ff3983 commit 3ecbd3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/deps
/doc
/.elixir_ls
/.elixir-tools
erl_crash.dump
*.ez
src/*.erl
Expand Down
12 changes: 7 additions & 5 deletions lib/absinthe/phase/document/execution/resolution.ex
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,14 @@ defmodule Absinthe.Phase.Document.Execution.Resolution do
defp reduce_resolution(%{middleware: []} = res), do: res

defp reduce_resolution(%{middleware: [middleware | remaining_middleware]} = res) do
case call_middleware(middleware, %{res | middleware: remaining_middleware}) do
%{state: :suspended} = res ->
res
: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

res ->
reduce_resolution(res)
{result, %{middleware: middleware, resolution: res}}
end
end

Expand Down

0 comments on commit 3ecbd3e

Please sign in to comment.