diff --git a/apps/elixir_ls_debugger/lib/debugger/output.ex b/apps/elixir_ls_debugger/lib/debugger/output.ex index 9c01b8d84..62ceb5cf1 100644 --- a/apps/elixir_ls_debugger/lib/debugger/output.ex +++ b/apps/elixir_ls_debugger/lib/debugger/output.ex @@ -65,7 +65,7 @@ defmodule ElixirLS.Debugger.Output do common_properties = %{ "elixir_ls.elixir_version" => System.version(), "elixir_ls.otp_release" => System.otp_release(), - "elixir_ls.erts_version" => Application.spec(:erts, :vsn), + "elixir_ls.erts_version" => to_string(Application.spec(:erts, :vsn)), "elixir_ls.mix_env" => Mix.env(), "elixir_ls.mix_target" => Mix.target() } diff --git a/apps/elixir_ls_debugger/lib/debugger/server.ex b/apps/elixir_ls_debugger/lib/debugger/server.ex index 56a75861d..23659fb80 100644 --- a/apps/elixir_ls_debugger/lib/debugger/server.ex +++ b/apps/elixir_ls_debugger/lib/debugger/server.ex @@ -196,7 +196,7 @@ defmodule ElixirLS.Debugger.Server do other -> Output.telemetry( - "elixir_ls.dap_server_error", + "dap_server_error", %{ "elixir_ls.dap_server_error" => inspect(other) }, @@ -335,9 +335,13 @@ defmodule ElixirLS.Debugger.Server do elapsed = System.monotonic_time(:millisecond) - start_time Output.send_response(packet, response_body) - Output.telemetry("elixir_ls.dap_request", %{"elixir_ls.dap_command" => command}, %{ - "elixir_ls.dap_request_time" => elapsed - }) + Output.telemetry( + "dap_request", + %{"elixir_ls.dap_command" => String.replace(command, "/", "_")}, + %{ + "elixir_ls.dap_request_time" => elapsed + } + ) end state = %{ @@ -363,7 +367,7 @@ defmodule ElixirLS.Debugger.Server do def handle_cast({:receive_packet, request(_, "disconnect") = packet}, state = %__MODULE__{}) do Output.send_response(packet, %{}) - Output.telemetry("elixir_ls.dap_request", %{"elixir_ls.dap_command" => "disconnect"}, %{ + Output.telemetry("dap_request", %{"elixir_ls.dap_command" => "disconnect"}, %{ "elixir_ls.dap_request_time" => 0 }) @@ -382,7 +386,7 @@ defmodule ElixirLS.Debugger.Server do Output.send_response(packet, response_body) Output.telemetry( - "elixir_ls.dap_request", + "dap_request", %{"elixir_ls.dap_command" => "initialize"}, %{ "elixir_ls.dap_request_time" => elapsed @@ -406,9 +410,13 @@ defmodule ElixirLS.Debugger.Server do elapsed = System.monotonic_time(:millisecond) - start_time Output.send_response(packet, response_body) - Output.telemetry("elixir_ls.dap_request", %{"elixir_ls.dap_command" => command}, %{ - "elixir_ls.dap_request_time" => elapsed - }) + Output.telemetry( + "dap_request", + %{"elixir_ls.dap_command" => String.replace(command, "/", "_")}, + %{ + "elixir_ls.dap_request_time" => elapsed + } + ) state diff --git a/apps/language_server/lib/language_server/build.ex b/apps/language_server/lib/language_server/build.ex index c3b81a0ac..cf770a290 100644 --- a/apps/language_server/lib/language_server/build.ex +++ b/apps/language_server/lib/language_server/build.ex @@ -43,7 +43,7 @@ defmodule ElixirLS.LanguageServer.Build do Logger.warning("Mix.Dep.load_on_environment([]) failed: #{message}") JsonRpc.telemetry( - "elixir_ls.build_error", + "build_error", %{"elixir_ls.build_error" => message}, %{} ) @@ -66,7 +66,7 @@ defmodule ElixirLS.LanguageServer.Build do Tracer.save() Logger.info("Compile took #{div(us, 1000)} milliseconds") - JsonRpc.telemetry("elixir_ls.build", %{"elixir_ls.result" => result}, %{ + JsonRpc.telemetry("build", %{"elixir_ls.result" => result}, %{ "elixir_ls.build_time" => div(us, 1000) }) end) @@ -303,7 +303,7 @@ defmodule ElixirLS.LanguageServer.Build do Logger.error("mix clean returned #{inspect(results)}") JsonRpc.telemetry( - "elixir_ls.mix_clean_error", + "mix_clean_error", %{"elixir_ls.mix_clean_error" => inspect(results)}, %{} ) diff --git a/apps/language_server/lib/language_server/dialyzer.ex b/apps/language_server/lib/language_server/dialyzer.ex index ac0edc302..67318a15e 100644 --- a/apps/language_server/lib/language_server/dialyzer.ex +++ b/apps/language_server/lib/language_server/dialyzer.ex @@ -263,7 +263,7 @@ defmodule ElixirLS.LanguageServer.Dialyzer do Logger.error(message) JsonRpc.telemetry( - "elixir_ls.dialyzer_error", + "dialyzer_error", %{"elixir_ls.dialyzer_error" => message}, %{} ) @@ -420,7 +420,7 @@ defmodule ElixirLS.LanguageServer.Dialyzer do Logger.info("[ElixirLS Dialyzer] Analysis finished in #{div(us, 1000)} milliseconds") - JsonRpc.telemetry("elixir_ls.dialyzer", %{}, %{"elixir_ls.dialyzer_time" => div(us, 1000)}) + JsonRpc.telemetry("dialyzer", %{}, %{"elixir_ls.dialyzer_time" => div(us, 1000)}) analysis_finished(parent, :ok, active_plt, mod_deps, md5, warnings, timestamp, build_ref) end @@ -500,7 +500,7 @@ defmodule ElixirLS.LanguageServer.Dialyzer do ) JsonRpc.telemetry( - "elixir_ls.dialyzer_error", + "dialyzer_error", %{"elixir_ls.dialyzer_error" => inspect(reason)}, %{} ) diff --git a/apps/language_server/lib/language_server/dialyzer/analyzer.ex b/apps/language_server/lib/language_server/dialyzer/analyzer.ex index dbe1e6e61..710e1e7e3 100644 --- a/apps/language_server/lib/language_server/dialyzer/analyzer.ex +++ b/apps/language_server/lib/language_server/dialyzer/analyzer.ex @@ -210,6 +210,6 @@ defmodule ElixirLS.LanguageServer.Dialyzer.Analyzer do "Analysis failed: " <> Exception.format_exit(reason) <> "\n" <> Enum.join(log_cache, "\n") Logger.error(message) - JsonRpc.telemetry("elixir_ls.dialyzer_error", %{"elixir_ls.dialyzer_error" => message}, %{}) + JsonRpc.telemetry("dialyzer_error", %{"elixir_ls.dialyzer_error" => message}, %{}) end end diff --git a/apps/language_server/lib/language_server/dialyzer/manifest.ex b/apps/language_server/lib/language_server/dialyzer/manifest.ex index 97de10257..51b9d7bac 100644 --- a/apps/language_server/lib/language_server/dialyzer/manifest.ex +++ b/apps/language_server/lib/language_server/dialyzer/manifest.ex @@ -42,7 +42,7 @@ defmodule ElixirLS.LanguageServer.Dialyzer.Manifest do ) JsonRpc.telemetry( - "elixir_ls.dialyzer_error", + "dialyzer_error", %{ "elixir_ls.dialyzer_error" => "Dialyzer PLT build process exited with reason: #{error_msg}" diff --git a/apps/language_server/lib/language_server/json_rpc.ex b/apps/language_server/lib/language_server/json_rpc.ex index 089b05768..754776fbc 100644 --- a/apps/language_server/lib/language_server/json_rpc.ex +++ b/apps/language_server/lib/language_server/json_rpc.ex @@ -94,7 +94,7 @@ defmodule ElixirLS.LanguageServer.JsonRpc do common_properties = %{ "elixir_ls.elixir_version" => System.version(), "elixir_ls.otp_release" => System.otp_release(), - "elixir_ls.erts_version" => Application.spec(:erts, :vsn), + "elixir_ls.erts_version" => to_string(Application.spec(:erts, :vsn)), "elixir_ls.mix_env" => Mix.env(), "elixir_ls.mix_target" => Mix.target() } diff --git a/apps/language_server/lib/language_server/providers/folding_range/token.ex b/apps/language_server/lib/language_server/providers/folding_range/token.ex index 7e1477b61..62dc03b53 100644 --- a/apps/language_server/lib/language_server/providers/folding_range/token.ex +++ b/apps/language_server/lib/language_server/providers/folding_range/token.ex @@ -44,7 +44,7 @@ defmodule ElixirLS.LanguageServer.Providers.FoldingRange.Token do Logger.warning("Unmatched token: #{inspect(error)}") JsonRpc.telemetry( - "elixir_ls.folding_ranges_error", + "folding_ranges_error", %{"elixir_ls.folding_ranges_error" => inspect(error)}, %{} ) diff --git a/apps/language_server/lib/language_server/server.ex b/apps/language_server/lib/language_server/server.ex index 08433fed1..fe78e2fe8 100644 --- a/apps/language_server/lib/language_server/server.ex +++ b/apps/language_server/lib/language_server/server.ex @@ -142,7 +142,7 @@ defmodule ElixirLS.LanguageServer.Server do other -> JsonRpc.telemetry( - "elixir_ls.lsp_server_error", + "lsp_server_error", %{ "elixir_ls.lsp_server_error" => inspect(other) }, @@ -165,9 +165,9 @@ defmodule ElixirLS.LanguageServer.Server do JsonRpc.respond_with_error(id, type, msg) JsonRpc.telemetry( - "elixir_ls.lsp_request_error", + "lsp_request_error", %{ - "elixir_ls.lsp_command" => command, + "elixir_ls.lsp_command" => String.replace(command, "/", "_"), "elixir_ls.lsp_error" => type, "elixir_ls.lsp_error_message" => msg }, @@ -178,9 +178,13 @@ defmodule ElixirLS.LanguageServer.Server do elapsed = System.monotonic_time(:millisecond) - start_time JsonRpc.respond(id, result) - JsonRpc.telemetry("elixir_ls.lsp_request", %{"elixir_ls.lsp_command" => command}, %{ - "elixir_ls.lsp_request_time" => elapsed - }) + JsonRpc.telemetry( + "lsp_request", + %{"elixir_ls.lsp_command" => String.replace(command, "/", "_")}, + %{ + "elixir_ls.lsp_request_time" => elapsed + } + ) end state = %{state | requests: requests} @@ -313,9 +317,9 @@ defmodule ElixirLS.LanguageServer.Server do JsonRpc.respond_with_error(id, :server_error, error_msg) JsonRpc.telemetry( - "elixir_ls.lsp_request_error", + "lsp_request_error", %{ - "elixir_ls.lsp_command" => command, + "elixir_ls.lsp_command" => String.replace(command, "/", "_"), "elixir_ls.lsp_error" => :server_error, "elixir_ls.lsp_error_message" => error_msg }, @@ -647,7 +651,7 @@ defmodule ElixirLS.LanguageServer.Server do elapsed = System.monotonic_time(:millisecond) - start_time JsonRpc.respond(id, result) - JsonRpc.telemetry("elixir_ls.lsp_request", %{"elixir_ls.lsp_command" => "initialize"}, %{ + JsonRpc.telemetry("lsp_request", %{"elixir_ls.lsp_command" => "initialize"}, %{ "elixir_ls.lsp_request_time" => elapsed }) @@ -657,7 +661,7 @@ defmodule ElixirLS.LanguageServer.Server do JsonRpc.respond_with_error(id, :server_not_initialized) JsonRpc.telemetry( - "elixir_ls.lsp_request_error", + "lsp_request_error", %{ "elixir_ls.lsp_command" => "initialize", "elixir_ls.lsp_error" => :server_not_initialized, @@ -692,9 +696,13 @@ defmodule ElixirLS.LanguageServer.Server do elapsed = System.monotonic_time(:millisecond) - start_time JsonRpc.respond(id, result) - JsonRpc.telemetry("elixir_ls.lsp_request", %{"elixir_ls.lsp_command" => command}, %{ - "elixir_ls.lsp_request_time" => elapsed - }) + JsonRpc.telemetry( + "lsp_request", + %{"elixir_ls.lsp_command" => String.replace(command, "/", "_")}, + %{ + "elixir_ls.lsp_request_time" => elapsed + } + ) state @@ -702,9 +710,9 @@ defmodule ElixirLS.LanguageServer.Server do JsonRpc.respond_with_error(id, type, msg) JsonRpc.telemetry( - "elixir_ls.lsp_request_error", + "lsp_request_error", %{ - "elixir_ls.lsp_command" => command, + "elixir_ls.lsp_command" => String.replace(command, "/", "_"), "elixir_ls.lsp_error" => type, "elixir_ls.lsp_error_message" => msg }, @@ -722,9 +730,9 @@ defmodule ElixirLS.LanguageServer.Server do JsonRpc.respond_with_error(id, :invalid_params, e.message) JsonRpc.telemetry( - "elixir_ls.lsp_request_error", + "lsp_request_error", %{ - "elixir_ls.lsp_command" => command, + "elixir_ls.lsp_command" => String.replace(command, "/", "_"), "elixir_ls.lsp_error" => :invalid_params, "elixir_ls.lsp_error_message" => e.message }, @@ -739,9 +747,9 @@ defmodule ElixirLS.LanguageServer.Server do JsonRpc.respond_with_error(id, :server_error, error_msg) JsonRpc.telemetry( - "elixir_ls.lsp_request_error", + "lsp_request_error", %{ - "elixir_ls.lsp_command" => command, + "elixir_ls.lsp_command" => String.replace(command, "/", "_"), "elixir_ls.lsp_error" => :server_error, "elixir_ls.lsp_error_message" => error_msg }, @@ -756,9 +764,9 @@ defmodule ElixirLS.LanguageServer.Server do JsonRpc.respond_with_error(id, :invalid_request) JsonRpc.telemetry( - "elixir_ls.lsp_request_error", + "lsp_request_error", %{ - "elixir_ls.lsp_command" => command, + "elixir_ls.lsp_command" => String.replace(command, "/", "_"), "elixir_ls.lsp_error" => :invalid_request, "elixir_ls.lsp_error_message" => "Invalid Request" }, @@ -1433,7 +1441,7 @@ defmodule ElixirLS.LanguageServer.Server do Logger.error("client/registerCapability returned: #{inspect(other)}") JsonRpc.telemetry( - "elixir_ls.reverse_request_error", + "reverse_request_error", %{ "elixir_ls.reverse_request_error" => inspect(other), "elixir_ls.reverse_request" => "client/registerCapability" @@ -1460,7 +1468,7 @@ defmodule ElixirLS.LanguageServer.Server do Logger.error("client/registerCapability returned: #{inspect(other)}") JsonRpc.telemetry( - "elixir_ls.reverse_request_error", + "reverse_request_error", %{ "elixir_ls.reverse_request_error" => inspect(other), "elixir_ls.reverse_request" => "client/registerCapability" @@ -1676,7 +1684,7 @@ defmodule ElixirLS.LanguageServer.Server do Logger.error("Cannot get client configuration: #{inspect(other)}") JsonRpc.telemetry( - "elixir_ls.reverse_request_error", + "reverse_request_error", %{ "elixir_ls.reverse_request_error" => inspect(other), "elixir_ls.reverse_request" => "workspace/configuration" @@ -1757,7 +1765,7 @@ defmodule ElixirLS.LanguageServer.Server do ) JsonRpc.telemetry( - "elixir_ls.parser_error", + "parser_error", %{"elixir_ls.parser_error" => Exception.format(:error, e, __STACKTRACE__)}, %{} )