Skip to content
This repository was archived by the owner on Nov 18, 2020. It is now read-only.

Commit 9e676a8

Browse files
Adapt rabbitmq-diagnostics memory_breakdown to server master
Specifically to rabbitmq/rabbitmq-server#1404. Closes #228. [#153217000]
1 parent 1c8ec46 commit 9e676a8

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lib/rabbitmq/cli/diagnostics/commands/memory_breakdown_command.ex

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,19 @@ defmodule RabbitMQ.CLI.Diagnostics.Commands.MemoryBreakdownCommand do
8181
#
8282

8383
defp compute_relative_values(all_pairs) do
84-
pairs = Keyword.delete(all_pairs, :total)
85-
total = Enum.reduce(pairs, 0, fn({_, bytes}, acc) -> acc + bytes end)
84+
strategy = Keyword.get(all_pairs, :strategy)
85+
num_pairs = Keyword.delete(all_pairs, :strategy)
86+
# Includes RSS, allocated and runtime-used ("erlang") values
87+
# See https://github.com/rabbitmq/rabbitmq-server/pull/1404.
88+
totals = Keyword.get(num_pairs, :total)
89+
pairs = Keyword.delete(num_pairs, :total)
90+
total = Keyword.get(totals, strategy) ||
91+
# should not be necessary but be more defensive
92+
# the list of totals depends on the strategy, so
93+
# we have multiple fallback options
94+
Keyword.get(totals, :rss) ||
95+
Keyword.get(totals, :allocated) ||
96+
Keyword.get(totals, :erlang)
8697

8798
pairs
8899
|> Enum.map(fn({k, v}) ->

0 commit comments

Comments
 (0)