-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lots of Telemetry Warnings #61
Comments
It happens because schematic is being run at compile time, but the telemetry application hasn't started yet. I haven't looked closely into how to fix it yet. |
Gotcha. If you're up for it, I could submit PR to |
I think it makes more sense to figure out how to start the telemetry application before the modules compile, or (which i think i'll do anyway) rewrite the parts that use schematic at compile time to use it at runtime. |
Sounds good. Just FYI here is the predicate code I used in my fork: defmodule Schematic.TelemetryCfg do
@moduledoc """
Manage telemetry settings for Schematic.
This module performs two functions:
1. check to see if the current execution environment is `run-time` or
`compile-time` (we want to disable telemetry at compile time).
2. check to see if the application config has disabled telemetry
## Example
In `config/config.exs`:
```elixir
config :schematic, :config, disable_telemetry: true
\```
"""
@disable_telemetry_predicate Application.compile_env(:schematic, :config)[:disable_telemetry]
@doc """
Predicate used to determine if telemetry should be enabled in `Schematic`.
To optionally disable schematic telemetry in your application, enter the following into your `config/config.exs` file:
```elixir
config :schematic, :config, disable_telemetry: true
\```
"""
def enable_telemetry? do
running?() && telemetry_allowed?()
end
defp telemetry_disabled? do
@disable_telemetry_predicate
end
defp telemetry_allowed? do
!telemetry_disabled?()
end
# from https://elixirforum.com/t/is-it-possible-to-detect-if-code-is-executing-at-compile-time/57728
def compiling? do
# TODO: When we depend on Elixir v1.11+ only, remove function_exported and elixir_compiler_pid
process_alive?(:can_await_module_compilation?) ||
process_alive?(:elixir_compiler_pid)
end
defp process_alive?(:can_await_module_compilation?) do
Code.ensure_loaded?(Code) &&
function_exported?(Code, :can_await_module_compilation?, 0) &&
apply(Code, :can_await_module_compilation?, [])
end
defp process_alive?(name) do
case Process.get(name) do
nil -> false
pid when is_pid(pid) -> true
end
end
defp running? do
! compiling?()
end
end |
a partial fix i believe is released with 0.14.2 |
This should be completely fixed with 0.14.3 |
When I compile or run Tableau, I get many Telemetry Warnings
I get the same behavior on Elixir 1.15 and 1.16
I believe the warnings come from a library schematic in the telemetry_wrap function of
schematic.ex
.Here's my workaround to remove the telemetry warnings:
Does anyone else see these warnings?
Are the telemetry metrics in
Schematic
necessary?Is there a way to suppress the telemetry warnings without altering the
Schematic
code?The text was updated successfully, but these errors were encountered: