fix(dashboard): display full Erlang/OTP version
This commit is contained in:
parent
05835f2fab
commit
171933301a
|
@ -553,7 +553,7 @@ rpc_call(Node, Fun, Args) ->
|
|||
end.
|
||||
|
||||
otp_rel() ->
|
||||
lists:concat(["R", erlang:system_info(otp_release), "/", erlang:system_info(version)]).
|
||||
lists:concat([emqx_vm:get_otp_version(), "/", erlang:system_info(version)]).
|
||||
|
||||
check_row_limit(Tables) ->
|
||||
check_row_limit(Tables, max_row_limit()).
|
||||
|
|
|
@ -369,16 +369,17 @@ compat_windows(Fun) ->
|
|||
end.
|
||||
|
||||
%% @doc Return on which Eralng/OTP the current vm is running.
|
||||
%% NOTE: This API reads a file, do not use it in critical code paths.
|
||||
get_otp_version() ->
|
||||
string:trim(binary_to_list(read_otp_version())).
|
||||
parse_built_on(read_otp_version()).
|
||||
|
||||
read_otp_version() ->
|
||||
ReleasesDir = filename:join([code:root_dir(), "releases"]),
|
||||
Filename = filename:join([ReleasesDir, emqx_app:get_release(), "BUILT_ON"]),
|
||||
case file:read_file(Filename) of
|
||||
{ok, Vsn} ->
|
||||
{ok, BuiltOn} ->
|
||||
%% running on EQM X release
|
||||
Vsn;
|
||||
BuiltOn;
|
||||
{error, enoent} ->
|
||||
%% running tests etc.
|
||||
OtpMajor = erlang:system_info(otp_release),
|
||||
|
@ -386,3 +387,11 @@ read_otp_version() ->
|
|||
{ok, Vsn} = file:read_file(OtpVsnFile),
|
||||
Vsn
|
||||
end.
|
||||
|
||||
parse_built_on(BuiltOn) ->
|
||||
case binary:split(BuiltOn, <<"-">>, [global]) of
|
||||
[Vsn, <<"emqx">>, N | _] ->
|
||||
binary_to_list(Vsn) ++ "-emqx-" ++ binary_to_list(N);
|
||||
[Vsn | _] ->
|
||||
string:trim(binary_to_list(Vsn))
|
||||
end.
|
||||
|
|
Loading…
Reference in New Issue