diff --git a/lib/ash/tracer/tracer.ex b/lib/ash/tracer/tracer.ex index 01683f29..37bbb08d 100644 --- a/lib/ash/tracer/tracer.ex +++ b/lib/ash/tracer/tracer.ex @@ -85,17 +85,19 @@ defmodule Ash.Tracer do metadata = unquote(metadata) + compiling? = Code.can_await_module_compilation?() + metadata = - case :telemetry.list_handlers(telemetry_name) do - [] -> %{} - _ when is_function(metadata) -> apply(metadata, []) - _ -> metadata + unless compiling? do + case :telemetry.list_handlers(telemetry_name) do + [] -> %{} + _ when is_function(metadata) -> apply(metadata, []) + _ -> metadata + end end start = System.monotonic_time() - compiling? = Code.can_await_module_compilation?() - unless compiling? do :telemetry.execute( telemetry_name ++ [:start],