|
|
@ -28,7 +28,7 @@ start(_StartType, _StartArgs) -> |
|
|
|
|
|
|
|
boot() -> |
|
|
|
%% Handle the default sink. |
|
|
|
tryStartAsyncer(?RumDefSink, rumUtil:get_env(?RumAppName, asyncThreshold, undefined), rumUtil:get_env(?RumAppName, asyncThresholdWindow, undefined)), |
|
|
|
tryStartAsyncMgr(?RumDefSink, rumUtil:get_env(?RumAppName, asyncThreshold, undefined), rumUtil:get_env(?RumAppName, asyncThresholdWindow, undefined)), |
|
|
|
|
|
|
|
_ = maybe_install_sink_killer(?RumDefSink, application:get_env(lager, killer_hwm, undefined), |
|
|
|
application:get_env(lager, killer_reinstall_after, undefined)), |
|
|
@ -68,17 +68,20 @@ stop(Handlers) -> |
|
|
|
end, Handlers), |
|
|
|
rumConfig:cleanup(). |
|
|
|
|
|
|
|
tryStartAsyncer(_Sink, undefined, _Window) -> |
|
|
|
ok; |
|
|
|
tryStartAsyncer(_Sink, Threshold, _Window) when not is_integer(Threshold) orelse Threshold < 0 -> |
|
|
|
tryStartAsyncMgr(undefined, _Window, _SinkS) -> |
|
|
|
ignore; |
|
|
|
tryStartAsyncMgr(Threshold, Window, Sink) -> |
|
|
|
case |
|
|
|
startThrottle(Sink, Threshold, Window) |
|
|
|
tryStartAsyncMgr(_Sink, Threshold, _Window) when not is_integer(Threshold) orelse Threshold < 0 -> |
|
|
|
error_logger:error_msg("Invalid value for 'asyncThreshold': ~p~n", [Threshold]), |
|
|
|
throw({error, bad_config}); |
|
|
|
tryStartAsyncer(Sink, Threshold, undefined) -> |
|
|
|
tryStartAsyncMgr(Sink, Threshold, undefined) -> |
|
|
|
startThrottle(Sink, Threshold, erlang:trunc(Threshold * 0.2)); |
|
|
|
tryStartAsyncer(_Sink, Threshold, Window) when not is_integer(Window) orelse Window > Threshold orelse Window < 0 -> |
|
|
|
tryStartAsyncMgr(_Sink, Threshold, Window) when not is_integer(Window) orelse Window > Threshold orelse Window < 0 -> |
|
|
|
error_logger:error_msg("Invalid value for 'asyncThresholdWindow': ~p~n", [Window]), |
|
|
|
throw({error, bad_config}); |
|
|
|
tryStartAsyncer(Sink, Threshold, Window) -> |
|
|
|
tryStartAsyncMgr(Sink, Threshold, Window) -> |
|
|
|
startThrottle(Sink, Threshold, Window). |
|
|
|
|
|
|
|
startThrottle(Sink, Threshold, Window) -> |
|
|
@ -214,7 +217,7 @@ configure_sink(Sink, SinkDef) -> |
|
|
|
rumConfig:initSink(Sink), |
|
|
|
ChildId = rumUtil:make_internal_sink_name(Sink), |
|
|
|
_ = supervisor:start_child(eRum_sup, {ChildId, {gen_event, start_link, [{local, Sink}]}, permanent, 5000, worker, dynamic}), |
|
|
|
tryStartAsyncer(Sink, proplists:get_value(asyncThreshold, SinkDef), proplists:get_value(asyncThresholdWindow, SinkDef)), |
|
|
|
tryStartAsyncMgr(Sink, proplists:get_value(asyncThreshold, SinkDef), proplists:get_value(asyncThresholdWindow, SinkDef)), |
|
|
|
_ = maybe_install_sink_killer(Sink, proplists:get_value(killer_hwm, SinkDef), |
|
|
|
proplists:get_value(killer_reinstall_after, SinkDef)), |
|
|
|
start_handlers(Sink, proplists:get_value(handlers, SinkDef, [])), |
|
|
|