improvement: don't call telemetry when compiling

This commit is contained in:
Zach Daniel 2024-02-08 10:48:12 -05:00
parent d47eb086a2
commit 2074cbe997

View file

@ -82,17 +82,22 @@ defmodule Ash.Tracer do
start = System.monotonic_time()
compiling? = Code.can_await_module_compilation?()
unless compiling? do
:telemetry.execute(
telemetry_name ++ [:start],
%{system_time: System.system_time()},
metadata
)
end
try do
unquote(opts[:do])
after
duration = System.monotonic_time() - start
unless compiling? do
:telemetry.execute(
telemetry_name ++ [:stop],
%{system_time: System.system_time(), duration: duration},
@ -101,6 +106,7 @@ defmodule Ash.Tracer do
end
end
end
end
def stop_span(nil), do: :ok