From a877ecb1a38b723b92c973ebb8268850872163a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20G=C3=B6m=C3=B6ri?= Date: Wed, 12 Mar 2025 00:07:04 +0100 Subject: [PATCH] Remove observer_cli from CLI escritps observer_cli (and its dependency recon) was declared as a dependency of rabbitmq_cli and as a consequence included in all escritps. However the major part of observer_cli runs in the broker. The cli side only used `observer_cli:rpc_start/2` which is just an rpc call into the target node. By using common rpc call we can remove observer_cli and recon from the escripts. This can be considered a minor improvement based on the philosophy "simpler is better". As an additional benefit auto-completing functions of the recon app now works in `rabbitmq-diagnostics remote_shell`. (eg. `recon:proc_c`) (cherry picked from commit f9d3ed732bc766b9444f9a8b6adc0cac71cd3ca2) --- deps/rabbitmq_cli/Makefile | 2 +- .../rabbitmq/cli/diagnostics/commands/observer_command.ex | 6 +----- deps/rabbitmq_cli/mix.exs | 6 ------ 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/deps/rabbitmq_cli/Makefile b/deps/rabbitmq_cli/Makefile index 52ec6ddb7ade..9788f71e71aa 100644 --- a/deps/rabbitmq_cli/Makefile +++ b/deps/rabbitmq_cli/Makefile @@ -1,7 +1,7 @@ PROJECT = rabbitmq_cli BUILD_DEPS = rabbit_common -DEPS = csv json observer_cli stdout_formatter +DEPS = csv json stdout_formatter TEST_DEPS = amqp amqp_client temp x509 rabbit dep_amqp = hex 3.3.0 diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/diagnostics/commands/observer_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/diagnostics/commands/observer_command.ex index dd6cf0007aa1..44f6fd35a774 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/diagnostics/commands/observer_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/diagnostics/commands/observer_command.ex @@ -19,11 +19,7 @@ defmodule RabbitMQ.CLI.Diagnostics.Commands.ObserverCommand do @dialyzer {:nowarn_function, run: 2} def run([], %{node: node_name, interval: interval}) do - case :observer_cli.start(node_name, [{:interval, interval * 1000}]) do - # See zhongwencool/observer_cli#54 - {:badrpc, _} = err -> err - {:error, _} = err -> err - {:error, _, _} = err -> err + case :rabbit_misc.rpc_call(node_name, :observer_cli, :start, [interval * 1000], :infinity) do :ok -> {:ok, "Disconnected from #{node_name}."} :quit -> {:ok, "Disconnected from #{node_name}."} other -> other diff --git a/deps/rabbitmq_cli/mix.exs b/deps/rabbitmq_cli/mix.exs index f7ee9a756f45..a551b0f2dc5b 100644 --- a/deps/rabbitmq_cli/mix.exs +++ b/deps/rabbitmq_cli/mix.exs @@ -29,7 +29,6 @@ defmodule RabbitMQCtl.MixfileBase do JSON, :mnesia, :msacc, - :observer_cli, :public_key, :pubkey_cert, :rabbit, @@ -157,11 +156,6 @@ defmodule RabbitMQCtl.MixfileBase do path: Path.join(deps_dir, "stdout_formatter"), compile: if(is_bazel, do: fake_cmd, else: make_cmd) }, - { - :observer_cli, - path: Path.join(deps_dir, "observer_cli"), - compile: if(is_bazel, do: fake_cmd, else: make_cmd) - }, { :rabbit_common, path: Path.join(deps_dir, "rabbit_common"),