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<TAB>`)
This commit is contained in:
Péter Gömöri 2025-03-12 00:07:04 +01:00
parent 04a806731b
commit f9d3ed732b
3 changed files with 2 additions and 12 deletions

View File

@ -1,7 +1,7 @@
PROJECT = rabbitmq_cli PROJECT = rabbitmq_cli
BUILD_DEPS = rabbit_common BUILD_DEPS = rabbit_common
DEPS = csv json observer_cli stdout_formatter DEPS = csv json stdout_formatter
TEST_DEPS = amqp amqp_client temp x509 rabbit TEST_DEPS = amqp amqp_client temp x509 rabbit
dep_amqp = hex 3.3.0 dep_amqp = hex 3.3.0

View File

@ -19,11 +19,7 @@ defmodule RabbitMQ.CLI.Diagnostics.Commands.ObserverCommand do
@dialyzer {:nowarn_function, run: 2} @dialyzer {:nowarn_function, run: 2}
def run([], %{node: node_name, interval: interval}) do def run([], %{node: node_name, interval: interval}) do
case :observer_cli.start(node_name, [{:interval, interval * 1000}]) do case :rabbit_misc.rpc_call(node_name, :observer_cli, :start, [interval * 1000], :infinity) do
# See zhongwencool/observer_cli#54
{:badrpc, _} = err -> err
{:error, _} = err -> err
{:error, _, _} = err -> err
:ok -> {:ok, "Disconnected from #{node_name}."} :ok -> {:ok, "Disconnected from #{node_name}."}
:quit -> {:ok, "Disconnected from #{node_name}."} :quit -> {:ok, "Disconnected from #{node_name}."}
other -> other other -> other

View File

@ -29,7 +29,6 @@ defmodule RabbitMQCtl.MixfileBase do
JSON, JSON,
:mnesia, :mnesia,
:msacc, :msacc,
:observer_cli,
:public_key, :public_key,
:pubkey_cert, :pubkey_cert,
:rabbit, :rabbit,
@ -157,11 +156,6 @@ defmodule RabbitMQCtl.MixfileBase do
path: Path.join(deps_dir, "stdout_formatter"), path: Path.join(deps_dir, "stdout_formatter"),
compile: if(is_bazel, do: fake_cmd, else: make_cmd) 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, :rabbit_common,
path: Path.join(deps_dir, "rabbit_common"), path: Path.join(deps_dir, "rabbit_common"),