mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
improvement: don't call telemetry when compiling
This commit is contained in:
parent
d47eb086a2
commit
2074cbe997
1 changed files with 16 additions and 10 deletions
|
@ -82,22 +82,28 @@ defmodule Ash.Tracer do
|
|||
|
||||
start = System.monotonic_time()
|
||||
|
||||
:telemetry.execute(
|
||||
telemetry_name ++ [:start],
|
||||
%{system_time: System.system_time()},
|
||||
metadata
|
||||
)
|
||||
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
|
||||
|
||||
:telemetry.execute(
|
||||
telemetry_name ++ [:stop],
|
||||
%{system_time: System.system_time(), duration: duration},
|
||||
metadata
|
||||
)
|
||||
unless compiling? do
|
||||
:telemetry.execute(
|
||||
telemetry_name ++ [:stop],
|
||||
%{system_time: System.system_time(), duration: duration},
|
||||
metadata
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue