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

Commit b7270c5

Browse files
author
Diana Corbacho
committed
Return relative total as 100%
1 parent 897523c commit b7270c5

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/rabbit_mgmt_wm_node_memory.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ format(relative, Result) ->
8181
{[{total, Total}], Rest} = lists:splitwith(fun({Key, _}) ->
8282
Key == total
8383
end, Result),
84-
[{total, Total} | [{K, percentage(V, Total)} || {K, V} <- Rest]].
84+
[{total, 100} | [{K, percentage(V, Total)} || {K, V} <- Rest]].
8585

8686
percentage(Part, Total) ->
8787
case round((Part/Total) * 100) of

test/src/rabbit_mgmt_test_http.erl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ memory_test() ->
121121
assert_keys([memory], Result1),
122122
Breakdown = pget(memory, Result1),
123123
assert_keys(Keys, Breakdown),
124+
assert_item([{total, 100}], Breakdown),
124125
assert_percentage(Breakdown),
125126
http_get("/nodes/nonode/memory/relative", ?NOT_FOUND),
126127
ok.

0 commit comments

Comments
 (0)