fix: do not leak action configurations in alarm messages
This commit is contained in:
parent
cff8b97e8a
commit
4b540e3bd0
|
@ -1431,9 +1431,13 @@ maybe_alarm(_Status, _ResId, Error, Error) ->
|
||||||
maybe_alarm(_Status, ResId, Error, _PrevError) ->
|
maybe_alarm(_Status, ResId, Error, _PrevError) ->
|
||||||
HrError =
|
HrError =
|
||||||
case Error of
|
case Error of
|
||||||
{error, undefined} -> <<"Unknown reason">>;
|
{error, undefined} ->
|
||||||
{error, Reason} -> emqx_utils:readable_error_msg(Reason);
|
<<"Unknown reason">>;
|
||||||
_ -> emqx_utils:readable_error_msg(Error)
|
{error, Reason} ->
|
||||||
|
emqx_utils:readable_error_msg(Reason);
|
||||||
|
_ ->
|
||||||
|
Error1 = redact_config_from_error_status(Error),
|
||||||
|
emqx_utils:readable_error_msg(Error1)
|
||||||
end,
|
end,
|
||||||
emqx_alarm:safe_activate(
|
emqx_alarm:safe_activate(
|
||||||
ResId,
|
ResId,
|
||||||
|
@ -1442,6 +1446,11 @@ maybe_alarm(_Status, ResId, Error, _PrevError) ->
|
||||||
),
|
),
|
||||||
?tp(resource_activate_alarm, #{resource_id => ResId}).
|
?tp(resource_activate_alarm, #{resource_id => ResId}).
|
||||||
|
|
||||||
|
redact_config_from_error_status(#{config := _} = ErrorStatus) ->
|
||||||
|
maps:remove(config, ErrorStatus);
|
||||||
|
redact_config_from_error_status(Error) ->
|
||||||
|
Error.
|
||||||
|
|
||||||
-spec maybe_resume_resource_workers(resource_id(), resource_status()) -> ok.
|
-spec maybe_resume_resource_workers(resource_id(), resource_status()) -> ok.
|
||||||
maybe_resume_resource_workers(ResId, ?status_connected) ->
|
maybe_resume_resource_workers(ResId, ?status_connected) ->
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
|
|
Loading…
Reference in New Issue