refactor(alarm): refactor resource down alarm

This commit is contained in:
zhouzb 2020-08-22 15:11:44 +08:00 committed by tigercl
parent e232032ec0
commit 261bd66a3d
1 changed files with 1 additions and 2 deletions

View File

@ -342,8 +342,7 @@ normalize_message(too_many_processes, #{usage := Usage}) ->
list_to_binary(io_lib:format("~p% process usage", [Usage]));
normalize_message(partition, #{occurred := Node}) ->
list_to_binary(io_lib:format("Partition occurs at node ~s", [Node]));
normalize_message(ResourceDown = <<"resource", _/binary>>, _) ->
[_, Type, ID, _] = binary:split(ResourceDown, <<"/">>, [global, trim_all]),
normalize_message(<<"resource", _/binary>>, #{type := Type, id := ID}) ->
list_to_binary(io_lib:format("Resource ~s(~s) is down", [Type, ID]));
normalize_message(_Name, _UnknownDetails) ->
<<"Unknown alarm">>.