We use two repositories, and when we try to install for both of them it silently fails on the second one. I think this can be solved by adding the telemetry_prefix to the handler_id in the call to :telemetry.attach/4.
@doc """
Attaches `telemetry_handler/4` to application.
"""
@spec install(repo_module :: module()) :: :ok
def install(repo_module) when is_atom(repo_module) do
config = repo_module.config()
if config[:log] == false do
:telemetry.attach(
["ecto.dev_logger"] ++ config[:telemetry_prefix],
config[:telemetry_prefix] ++ [:query],
&__MODULE__.telemetry_handler/4,
nil
)
else
:ok
end
end
I also changed the if statement so that any response from the call to :telemetry.attach/4 doesn't get swallowed.
Happy to submit this as a PR if you agree that this makes sense? Also happy for anyone else to do this or solve in any other way :-)
Hi again,
We use two repositories, and when we try to install for both of them it silently fails on the second one. I think this can be solved by adding the
telemetry_prefix
to thehandler_id
in the call to:telemetry.attach/4
.I also changed the if statement so that any response from the call to
:telemetry.attach/4
doesn't get swallowed.Happy to submit this as a PR if you agree that this makes sense? Also happy for anyone else to do this or solve in any other way :-)