diff --git a/apps/ff_server/src/ff_server.erl b/apps/ff_server/src/ff_server.erl index 1a9f6123..6e901bed 100644 --- a/apps/ff_server/src/ff_server.erl +++ b/apps/ff_server/src/ff_server.erl @@ -51,7 +51,8 @@ stop(_State) -> init([]) -> IpEnv = genlib_app:env(?MODULE, ip, "::1"), Port = genlib_app:env(?MODULE, port, 8022), - HealthCheck = genlib_app:env(?MODULE, health_check, #{}), + HealthCheckReadiness = genlib_app:env(?MODULE, health_check_readiness, #{}), + HealthCheckLiveness = genlib_app:env(?MODULE, health_check_liveness, #{}), WoodyOptsEnv = genlib_app:env(?MODULE, woody_opts, #{}), PartyClient = party_client:create_client(), @@ -98,7 +99,10 @@ init([]) -> event_handler => ff_woody_event_handler, additional_routes => get_prometheus_routes() ++ ff_machine_handler:get_routes() ++ - [erl_health_handle:get_route(enable_health_logging(HealthCheck))] + [ + erl_health_handle:get_readiness_route(enable_health_logging(HealthCheckReadiness)), + erl_health_handle:get_liveness_route(enable_health_logging(HealthCheckLiveness)) + ] } ) ), diff --git a/apps/ff_server/test/ff_withdrawal_session_repair_SUITE.erl b/apps/ff_server/test/ff_withdrawal_session_repair_SUITE.erl index fb297c21..ff553adc 100644 --- a/apps/ff_server/test/ff_withdrawal_session_repair_SUITE.erl +++ b/apps/ff_server/test/ff_withdrawal_session_repair_SUITE.erl @@ -152,12 +152,7 @@ repair_failed_session_with_failure(C) -> <<"task_type">> := <<"init">> }, #{ - %% MAYBE io_lib:format instead of json compatible value - <<"error">> := [ - <<"exception">>, - <<"error">>, - #{<<"badmatch">> := #{<<"error">> := <<"notfound">>}} - ], + <<"error">> := <<"{exception,error,{badmatch,{error,notfound}}}">>, <<"task_status">> := <<"error">>, <<"task_type">> := <<"timeout">> }, @@ -180,11 +175,7 @@ repair_failed_session_with_failure(C) -> }, #{ %% Error because can`t notify withdrawal machine - <<"error">> := [ - <<"exception">>, - <<"error">>, - #{<<"unable_to_finish_session">> := #{<<"error">> := <<"notfound">>}} - ], + <<"error">> := <<"{exception,error,{unable_to_finish_session,{error,notfound}}}">>, <<"task_status">> := <<"error">>, <<"task_type">> := <<"timeout">> } diff --git a/apps/fistful/src/ff_machine.erl b/apps/fistful/src/ff_machine.erl index 015b9fbb..30852d52 100644 --- a/apps/fistful/src/ff_machine.erl +++ b/apps/fistful/src/ff_machine.erl @@ -176,7 +176,8 @@ extract_trace_id(_) -> null. extract_error(#{response := {error, Reason}}) -> - json_compatible_value(Reason); + %% unification with hellgate + unicode:characters_to_binary(io_lib:format("~p", [Reason])); extract_error(_) -> null. diff --git a/config/sys.config b/config/sys.config index 03bb6c0c..f25d11b8 100644 --- a/config/sys.config +++ b/config/sys.config @@ -249,10 +249,24 @@ } } }}, - {health_check, #{ + {health_check_liveness, #{ disk => {erl_health, disk, ["/", 99]}, memory => {erl_health, cg_memory, [99]}, service => {erl_health, service, [<<"fistful-server">>]} + }}, + {health_check_readiness, #{ + dmt_client => {dmt_client, health_check, []}, + progressor => + {progressor, health_check, [ + %% list of progressors namespaces for tests + [ + 'ff/source_v1', + 'ff/destination_v2', + 'ff/deposit_v1', + 'ff/withdrawal_v2', + 'ff/withdrawal/session_v2' + ] + ]} }} ]}, diff --git a/rebar.config b/rebar.config index f25b7ebf..58696564 100644 --- a/rebar.config +++ b/rebar.config @@ -34,7 +34,7 @@ {thrift, {git, "https://github.com/valitydev/thrift_erlang.git", {tag, "v1.0.0"}}}, {woody, {git, "https://github.com/valitydev/woody_erlang", {tag, "v1.1.1"}}}, {erl_health, {git, "https://github.com/valitydev/erlang-health.git", {branch, "master"}}}, - {machinery, {git, "https://github.com/valitydev/machinery-erlang.git", {tag, "v1.1.20"}}}, + {machinery, {git, "https://github.com/valitydev/machinery-erlang.git", {tag, "v1.1.21"}}}, {damsel, {git, "https://github.com/valitydev/damsel.git", {tag, "v2.2.20"}}}, {dmt_client, {git, "https://github.com/valitydev/dmt_client.git", {tag, "v2.0.3"}}}, {fistful_proto, {git, "https://github.com/valitydev/fistful-proto.git", {tag, "v2.0.2"}}}, diff --git a/rebar.lock b/rebar.lock index d014f76f..7e0969b9 100644 --- a/rebar.lock +++ b/rebar.lock @@ -41,6 +41,10 @@ {git,"https://github.com/valitydev/epg_connector.git", {ref,"939a0d4ab3f7561a79b45381bbe13029d9263006"}}, 2}, + {<<"epg_migrator">>, + {git,"https://github.com/valitydev/epg_migrator.git", + {ref,"8633c43fb4d022355c1498c0effa9ecf4098a67f"}}, + 2}, {<<"epgsql">>, {git,"https://github.com/epgsql/epgsql.git", {ref,"28e9f84c95065a51e92baeb37d2cf1687fc4b9ce"}}, @@ -49,6 +53,7 @@ {git,"https://github.com/valitydev/erlang-health.git", {ref,"49716470d0e8dab5e37db55d52dea78001735a3d"}}, 0}, + {<<"erlydtl">>,{pkg,<<"erlydtl">>,<<"0.14.0">>},3}, {<<"fistful_proto">>, {git,"https://github.com/valitydev/fistful-proto.git", {ref,"f7ce08e529188f6786caffecc10978c2b28603f6"}}, @@ -71,7 +76,7 @@ 0}, {<<"machinery">>, {git,"https://github.com/valitydev/machinery-erlang.git", - {ref,"5b3ad0c039c447eee6dec71ce6a5dce5538c8ec7"}}, + {ref,"24982b9ae38e029d23b724b0cbf7105c1ad978c9"}}, 0}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"mg_proto">>, @@ -95,7 +100,7 @@ 0}, {<<"progressor">>, {git,"https://github.com/valitydev/progressor.git", - {ref,"c55edd1846eaa08774f0ddfd575cec06affc70ac"}}, + {ref,"90f46570007a1cbf7cac960059fe6c8018702489"}}, 1}, {<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.11.0">>},0}, {<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.9">>},0}, @@ -148,6 +153,7 @@ {<<"cowlib">>, <<"0B9FF9C346629256C42EBE1EEB769A83C6CB771A6EE5960BD110AB0B9B872063">>}, {<<"crc32cer">>, <<"B550DA6D615FEB72A882D15D020F8F7DEE72DFB2CB1BCDF3B1EE8DC2AFD68CFC">>}, {<<"ctx">>, <<"8FF88B70E6400C4DF90142E7F130625B82086077A45364A78D208ED3ED53C7FE">>}, + {<<"erlydtl">>, <<"964B2DC84F8C17ACFAA69C59BA129EF26AC45D2BA898C3C6AD9B5BDC8BA13CED">>}, {<<"gproc">>, <<"853CCB7805E9ADA25D227A157BA966F7B34508F386A3E7E21992B1B484230699">>}, {<<"grpcbox">>, <<"6E040AB3EF16FE699FFB513B0EF8E2E896DA7B18931A1EF817143037C454BCCE">>}, {<<"hackney">>, <<"C4443D960BB9FBA6D01161D01CD81173089686717D9490E5D3606644C48D121F">>}, @@ -182,6 +188,7 @@ {<<"cowlib">>, <<"2B3E9DA0B21C4565751A6D4901C20D1B4CC25CBB7FD50D91D2AB6DD287BC86A9">>}, {<<"crc32cer">>, <<"A39B8F0B1990AC1BF06C3A247FC6A178B740CDFC33C3B53688DC7DD6B1855942">>}, {<<"ctx">>, <<"A14ED2D1B67723DBEBBE423B28D7615EB0BDCBA6FF28F2D1F1B0A7E1D4AA5FC2">>}, + {<<"erlydtl">>, <<"D80EC044CD8F58809C19D29AC5605BE09E955040911B644505E31E9DD8143431">>}, {<<"gproc">>, <<"587E8AF698CCD3504CF4BA8D90F893EDE2B0F58CABB8A916E2BF9321DE3CF10B">>}, {<<"grpcbox">>, <<"4A3B5D7111DAABC569DC9CBD9B202A3237D81C80BF97212FBC676832CB0CEB17">>}, {<<"hackney">>, <<"9AFCDA620704D720DB8C6A3123E9848D09C87586DC1C10479C42627B905B5C5E">>},