feat(emqx): Add backtrace_depth configuration

This commit is contained in:
Zaiming Shi 2021-03-23 19:58:22 +01:00 committed by Zaiming (Stone) Shi
parent dee375d4db
commit a4b30ea77c
3 changed files with 14 additions and 2 deletions

View File

@ -301,6 +301,8 @@ node.crash_dump = {{ platform_log_dir }}/crash.dump
node.dist_listen_min = 6369 node.dist_listen_min = 6369
node.dist_listen_max = 6369 node.dist_listen_max = 6369
node.backtrace_depth = 16
## CONFIG_SECTION_BGN=rpc ====================================================== ## CONFIG_SECTION_BGN=rpc ======================================================
## RPC Mode. ## RPC Mode.

View File

@ -334,6 +334,11 @@ end}.
hidden hidden
]}. ]}.
{mapping, "node.backtrace_depth", "emqx.backtrace_depth", [
{default, 16},
{datatype, integer}
]}.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% RPC %% RPC
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------

View File

@ -33,6 +33,7 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
start(_Type, _Args) -> start(_Type, _Args) ->
set_backtrace_depth(),
print_otp_version_warning(), print_otp_version_warning(),
print_banner(), print_banner(),
ekka:start(), ekka:start(),
@ -40,8 +41,7 @@ start(_Type, _Args) ->
ok = start_autocluster(), ok = start_autocluster(),
ok = emqx_plugins:init(), ok = emqx_plugins:init(),
_ = emqx_plugins:load(), _ = emqx_plugins:load(),
emqx_boot:is_enabled(listeners) emqx_boot:is_enabled(listeners) andalso (ok = emqx_listeners:start()),
andalso (ok = emqx_listeners:start()),
register(emqx, self()), register(emqx, self()),
ok = emqx_alarm_handler:load(), ok = emqx_alarm_handler:load(),
print_vsn(), print_vsn(),
@ -53,6 +53,11 @@ stop(_State) ->
emqx_boot:is_enabled(listeners) emqx_boot:is_enabled(listeners)
andalso emqx_listeners:stop(). andalso emqx_listeners:stop().
set_backtrace_depth() ->
Depth = application:get_env(?APP, backtrace_depth, 16),
_ = erlang:system_flag(backtrace_depth, Depth),
ok.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Print Banner %% Print Banner
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------