Преглед на файлове

fix(emqx_mgmt): show used and total ram from lc

Zaiming (Stone) Shi преди 3 години
родител
ревизия
eacd3847ed
променени са 4 файла, в които са добавени 6 реда и са изтрити 6 реда
  1. 1 1
      apps/emqx/rebar.config
  2. 3 3
      apps/emqx_management/src/emqx_mgmt.erl
  3. 1 1
      mix.exs
  4. 1 1
      rebar.config

+ 1 - 1
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"}}},

+ 3 - 3
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),
 

+ 1 - 1
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"},

+ 1 - 1
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"}}}