Remove looking_glass

It has largely been superseded by `perf`. It is no longer
generally useful. It can always be added to BUILD_DEPS for
the rare cases it is needed, or installed locally and
pointed to by setting its path to ERL_LIBS.
This commit is contained in:
Loïc Hoguin 2024-06-26 09:56:46 +02:00
parent 2b03233ac1
commit a64d1e67fc
No known key found for this signature in database
GPG Key ID: C69E26E3A9DF618F
11 changed files with 5 additions and 177 deletions

View File

@ -134,10 +134,7 @@ plt(
PLUGINS = all_plugins(
rabbitmq_workspace = "",
) + select({
"@rules_erlang//:debug_build": ["@looking_glass//:erlang_app"],
"//conditions:default": [],
})
)
rabbitmq_home(
name = "broker-home",
@ -286,7 +283,6 @@ moduleindex(
"@ct_helper//:erlang_app",
"@emqtt//:erlang_app",
"@inet_tcp_proxy_dist//:erlang_app",
"@looking_glass//:erlang_app",
"@meck//:erlang_app",
"@proper//:erlang_app",
"//deps/rabbitmq_ct_client_helpers:erlang_app",

View File

@ -54,13 +54,6 @@ bazel_dep(
version = "1.1.0",
)
bazel_dep(
name = "com_github_rabbitmq_looking_glass",
version = "0.2.2",
dev_dependency = True,
repo_name = "looking_glass",
)
bazel_dep(
name = "rabbitmq_osiris",
version = "1.8.1",

View File

@ -14,11 +14,11 @@ PACKAGES_DIR ?= $(abspath PACKAGES)
include plugins.mk
# An additional list of plugins to include in a RabbitMQ release,
# on top of the standard plugins. For example, looking_glass.
# on top of the standard plugins.
#
# Note: When including NIFs in a release make sure to build
# them on the appropriate platform for the target environment.
# For example build looking_glass on Linux when targeting Docker.
# For example build on Linux when targeting Docker.
ADDITIONAL_PLUGINS ?=
DEPS = rabbit_common rabbit $(PLUGINS) $(ADDITIONAL_PLUGINS)

View File

@ -186,8 +186,6 @@ test_suite_beam_files(name = "test_suite_beam_files")
# gazelle:erlang_app_dep sysmon_handler
# gazelle:erlang_app_dep systemd
# gazelle:erlang_app_dep_exclude looking_glass
rabbitmq_app(
name = "erlang_app",
srcs = [":all_srcs"],
@ -253,7 +251,6 @@ plt(
plt = "//:base_plt",
deps = [
"//deps/rabbitmq_cli:erlang_app", # keep
"@looking_glass//:erlang_app", # keep
],
)

View File

@ -132,11 +132,11 @@ endef
LOCAL_DEPS = sasl os_mon inets compiler public_key crypto ssl syntax_tools xmerl
BUILD_DEPS = rabbitmq_cli looking_glass
BUILD_DEPS = rabbitmq_cli
DEPS = ranch rabbit_common amqp10_common rabbitmq_prelaunch ra sysmon_handler stdout_formatter recon redbug observer_cli osiris syslog systemd seshat khepri khepri_mnesia_migration cuttlefish gen_batch_server
TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers meck proper amqp_client rabbitmq_amqp_client rabbitmq_amqp1_0
PLT_APPS += mnesia runtime_tools looking_glass
PLT_APPS += mnesia runtime_tools
dep_syslog = git https://github.com/schlagert/syslog 4.0.0
dep_osiris = git https://github.com/rabbitmq/osiris v1.8.1

3
deps/rabbit/app.bzl vendored
View File

@ -162,7 +162,6 @@ def all_beam_files(name = "all_beam_files"):
"src/rabbit_log_queue.erl",
"src/rabbit_log_tail.erl",
"src/rabbit_logger_exchange_h.erl",
"src/rabbit_looking_glass.erl",
"src/rabbit_maintenance.erl",
"src/rabbit_memory_monitor.erl",
"src/rabbit_message_interceptor.erl",
@ -422,7 +421,6 @@ def all_test_beam_files(name = "all_test_beam_files"):
"src/rabbit_log_queue.erl",
"src/rabbit_log_tail.erl",
"src/rabbit_logger_exchange_h.erl",
"src/rabbit_looking_glass.erl",
"src/rabbit_maintenance.erl",
"src/rabbit_memory_monitor.erl",
"src/rabbit_message_interceptor.erl",
@ -701,7 +699,6 @@ def all_srcs(name = "all_srcs"):
"src/rabbit_log_queue.erl",
"src/rabbit_log_tail.erl",
"src/rabbit_logger_exchange_h.erl",
"src/rabbit_looking_glass.erl",
"src/rabbit_maintenance.erl",
"src/rabbit_memory_monitor.erl",
"src/rabbit_message_interceptor.erl",

View File

@ -229,12 +229,6 @@
{requires, [core_initialized, recovery]},
{enables, routing_ready}]}).
-rabbit_boot_step({rabbit_looking_glass,
[{description, "Looking Glass tracer and profiler"},
{mfa, {rabbit_looking_glass, boot, []}},
{requires, [core_initialized, recovery]},
{enables, routing_ready}]}).
-rabbit_boot_step({rabbit_observer_cli,
[{description, "Observer CLI configuration"},
{mfa, {rabbit_observer_cli, init, []}},

View File

@ -1,102 +0,0 @@
%% This Source Code Form is subject to the terms of the Mozilla Public
%% License, v. 2.0. If a copy of the MPL was not distributed with this
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term Broadcom refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
%%
-module(rabbit_looking_glass).
-ignore_xref([
{lg, trace, 4},
{lg, stop, 0},
{lg_callgrind, profile_many, 3}
]).
-ignore_xref([{maps, from_list, 1}]).
-export([boot/0]).
-export([trace/1, trace_qq/0, profile/0, profile/1]).
-export([connections/0]).
boot() ->
case os:getenv("RABBITMQ_TRACER") of
false ->
ok;
On when On =:= "1" orelse On =:= "true" ->
rabbit_log:info("Loading Looking Glass profiler for interactive use"),
case application:ensure_all_started(looking_glass) of
{ok, _} -> ok;
{error, Error} ->
rabbit_log:error("Failed to start Looking Glass, reason: ~tp", [Error])
end;
Value ->
Input = parse_value(Value),
rabbit_log:info(
"Enabling Looking Glass profiler, input value: ~tp",
[Input]
),
{ok, _} = application:ensure_all_started(looking_glass),
lg:trace(
Input,
lg_file_tracer,
"traces.lz4",
maps:from_list([
{mode, profile},
{process_dump, true},
{running, true},
{send, true}]
)
)
end.
trace(Input) ->
lg:trace(Input,
lg_file_tracer,
"traces.lz4",
maps:from_list([
{mode, profile},
{process_dump, true},
{running, true},
{send, true}]
)).
trace_qq() ->
dbg:stop(),
lg:trace([ra_server,
ra_server_proc,
rabbit_fifo,
queue,
rabbit_fifo_index
],
lg_file_tracer,
"traces.lz4",
maps:from_list([
{mode, profile}
% {process_dump, true},
% {running, true},
% {send, true}
]
)),
timer:sleep(10000),
_ = lg:stop(),
profile().
profile() ->
profile("callgrind.out").
profile(Filename) ->
lg_callgrind:profile_many("traces.lz4.*", Filename, #{running => true}).
%%
%% Implementation
%%
parse_value(Value) ->
[begin
[Mod, Fun] = string:tokens(C, ":"),
{callback, list_to_atom(Mod), list_to_atom(Fun)}
end || C <- string:tokens(Value, ",")].
connections() ->
Pids = [Pid || {{conns_sup, _}, Pid} <- ets:tab2list(ranch_server)],
['_', {scope, Pids}].

View File

@ -70,28 +70,3 @@ CT_OPTS += -ct_hooks $(wordlist 2,$(words $(CT_HOOKS_PARAM_VALUE)),$(CT_HOOKS_PA
ifeq ($(SKIP_AS_ERROR),1)
export RABBITMQ_CT_SKIP_AS_ERROR = true
endif
# --------------------------------------------------------------------
# Looking Glass rules.
# --------------------------------------------------------------------
ifneq ("$(RABBITMQ_TRACER)","")
BUILD_DEPS += looking_glass
ERL_LIBS := "$(ERL_LIBS):../looking_glass:../lz4"
export RABBITMQ_TRACER
endif
define lg_callgrind.erl
lg_callgrind:profile_many("traces.lz4.*", "callgrind.out", #{running => true}),
halt().
endef
.PHONY: profile clean-profile
profile:
$(gen_verbose) $(call erlang,$(call lg_callgrind.erl))
clean:: clean-profile
clean-profile:
$(gen_verbose) rm -f traces.lz4.* callgrind.out.*

View File

@ -366,26 +366,6 @@ khepri_mnesia_migration:
- mnesia_to_khepri
- mnesia_to_khepri_converter
- mnesia_to_khepri_example_converter
looking_glass:
- lg
- lg_callgrind
- lg_file_reader
- lg_file_tracer
- lg_flame
- lg_messages
- lg_messages_seqdiag
- lg_rabbit_hole
- lg_raw_console_tracer
- lg_socket_client
- lg_socket_tracer
- lg_term
- lg_tracer
- lg_tracer_pool
- looking_glass_app
- looking_glass_sup
lz4:
- lz4_nif
- lz4f
meck:
- meck
- meck_args_matcher
@ -678,7 +658,6 @@ rabbit:
- rabbit_log_queue
- rabbit_log_tail
- rabbit_logger_exchange_h
- rabbit_looking_glass
- rabbit_maintenance
- rabbit_memory_monitor
- rabbit_message_interceptor

View File

@ -120,7 +120,6 @@ dep_gen_batch_server = hex 0.8.8
dep_jose = hex 1.11.10
dep_khepri = hex 0.13.0
dep_khepri_mnesia_migration = hex 0.4.0
dep_looking_glass = git https://github.com/rabbitmq/looking_glass.git main
dep_prometheus = hex 4.11.0
dep_ra = hex 2.11.0
dep_ranch = hex 2.1.0