From eacd3847edbb8cde4095aacf852203cfee403a78 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Fri, 27 May 2022 11:35:07 +0200 Subject: [PATCH] fix(emqx_mgmt): show used and total ram from lc --- apps/emqx/rebar.config | 2 +- apps/emqx_management/src/emqx_mgmt.erl | 6 +++--- mix.exs | 2 +- rebar.config | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/emqx/rebar.config b/apps/emqx/rebar.config index f4948bf1e..c4e18a758 100644 --- a/apps/emqx/rebar.config +++ b/apps/emqx/rebar.config @@ -22,7 +22,7 @@ %% This rebar.config is necessary because the app may be used as a %% `git_subdir` dependency in other projects. {deps, [ - {lc, {git, "https://github.com/emqx/lc.git", {tag, "0.3.0"}}}, + {lc, {git, "https://github.com/emqx/lc.git", {tag, "0.3.1"}}}, {gproc, {git, "https://github.com/uwiger/gproc", {tag, "0.8.0"}}}, {jiffy, {git, "https://github.com/emqx/jiffy", {tag, "1.0.5"}}}, {cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.9.0"}}}, diff --git a/apps/emqx_management/src/emqx_mgmt.erl b/apps/emqx_management/src/emqx_mgmt.erl index 6fac1229f..efaeb02b8 100644 --- a/apps/emqx_management/src/emqx_mgmt.erl +++ b/apps/emqx_management/src/emqx_mgmt.erl @@ -121,14 +121,14 @@ list_nodes() -> lookup_node(Node) -> node_info(Node). node_info() -> - Memory = emqx_vm:get_memory(), + {UsedRatio, Total} = load_ctl:get_sys_memory(), Info = maps:from_list([{K, list_to_binary(V)} || {K, V} <- emqx_vm:loads()]), BrokerInfo = emqx_sys:info(), Info#{ node => node(), otp_release => otp_rel(), - memory_total => proplists:get_value(allocated, Memory), - memory_used => proplists:get_value(used, Memory), + memory_total => Total, + memory_used => erlang:round(Total * UsedRatio), process_available => erlang:system_info(process_limit), process_used => erlang:system_info(process_count), diff --git a/mix.exs b/mix.exs index 00a1305be..86b1323a2 100644 --- a/mix.exs +++ b/mix.exs @@ -44,7 +44,7 @@ defmodule EMQXUmbrella.MixProject do # we need several overrides here because dependencies specify # other exact versions, and not ranges. [ - {:lc, github: "emqx/lc", tag: "0.3.0"}, + {:lc, github: "emqx/lc", tag: "0.3.1"}, {:redbug, "2.0.7"}, {:typerefl, github: "ieQu1/typerefl", tag: "0.9.1", override: true}, {:ehttpc, github: "emqx/ehttpc", tag: "0.2.0"}, diff --git a/rebar.config b/rebar.config index 11e36b5e1..53a5edd82 100644 --- a/rebar.config +++ b/rebar.config @@ -44,7 +44,7 @@ {post_hooks,[]}. {deps, - [ {lc, {git, "https://github.com/emqx/lc.git", {tag, "0.3.0"}}} + [ {lc, {git, "https://github.com/emqx/lc.git", {tag, "0.3.1"}}} , {redbug, "2.0.7"} , {gpb, "4.11.2"} %% gpb only used to build, but not for release, pin it here to avoid fetching a wrong version due to rebar plugins scattered in all the deps , {typerefl, {git, "https://github.com/ieQu1/typerefl", {tag, "0.9.1"}}}