Skip to content

Commit

Permalink
Restore FD info in rabbitmqctl status
Browse files Browse the repository at this point in the history
The FD limits are still valuable.

The FD used will still show some information during CQv1
upgrade to v2 so it is kept for now. But in the future
it will have to be reworked to query the system, or be
removed.
  • Loading branch information
lhoguin committed Jun 20, 2024
1 parent 32a4c54 commit 085d220
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion deps/rabbit/src/rabbit.erl
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,9 @@ status() ->
get_disk_free_limit, []}},
{disk_free, {rabbit_disk_monitor,
get_disk_free, []}}]),
S3 = rabbit_misc:with_exit_handler(
fun () -> [] end,
fun () -> [{file_descriptors, file_handle_cache:info()}] end),
S4 = [{processes, [{limit, erlang:system_info(process_limit)},
{used, erlang:system_info(process_count)}]},
{run_queue, erlang:statistics(run_queue)},
Expand Down Expand Up @@ -785,7 +788,7 @@ status() ->
(_) -> false
end,
maps:to_list(product_info())),
S1 ++ S2 ++ S4 ++ S5 ++ S6 ++ S7 ++ S8.
S1 ++ S2 ++ S3 ++ S4 ++ S5 ++ S6 ++ S7 ++ S8.

alarms() ->
Alarms = rabbit_misc:with_exit_handler(rabbit_misc:const([]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StatusCommand do
"#{category}: #{IU.convert(val[:bytes], unit)} #{unit} (#{val[:percentage]} %)"
end)

file_descriptors = [
"\n#{bright("File Descriptors")}\n",
"Total: #{m[:file_descriptors][:total_used]}, limit: #{m[:file_descriptors][:total_limit]}"
]

disk_space_section = [
"\n#{bright("Free Disk Space")}\n",
"Low free disk space watermark: #{IU.convert(m[:disk_free_limit], unit)} #{unit}",
Expand Down Expand Up @@ -194,7 +199,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StatusCommand do
log_section ++
alarms_section ++
memory_section ++
disk_space_section ++ totals_section ++ listeners_section
file_descriptors ++ disk_space_section ++ totals_section ++ listeners_section

{:ok, Enum.join(lines, line_separator())}
end
Expand Down Expand Up @@ -258,6 +263,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StatusCommand do
vm_memory_high_watermark_limit: Keyword.get(result, :vm_memory_limit),
disk_free_limit: Keyword.get(result, :disk_free_limit),
disk_free: Keyword.get(result, :disk_free),
file_descriptors: Enum.into(Keyword.get(result, :file_descriptors), %{}),
alarms: Keyword.get(result, :alarms),
listeners: listener_maps(Keyword.get(result, :listeners, [])),
memory: Keyword.get(result, :memory) |> Enum.into(%{}),
Expand Down

0 comments on commit 085d220

Please sign in to comment.