From 57aea31f97aae5cdd4851fe7e5bc07f26a73d07a Mon Sep 17 00:00:00 2001 From: ttt161 Date: Wed, 18 Mar 2026 18:53:06 +0300 Subject: [PATCH 1/6] bump machinery, update health probes --- apps/ff_server/src/ff_server.erl | 8 ++++++-- config/sys.config | 18 ++++++++++++++++-- rebar.config | 2 +- rebar.lock | 11 +++++++++-- 4 files changed, 32 insertions(+), 7 deletions(-) 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/config/sys.config b/config/sys.config index 03bb6c0c..58a8e2d3 100644 --- a/config/sys.config +++ b/config/sys.config @@ -249,11 +249,25 @@ } } }}, - {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' + ] + ]} + }}, ]}, {snowflake, [ diff --git a/rebar.config b/rebar.config index f25b7ebf..24d48176 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", {branch, "epic/graceful-shutdown"}}}, {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..9cd09edb 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,"0b992112c083330546f7365783d86f8817fbe9fa"}}, 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,"3b6abfb2e6dd94e508646c67837f7d5993c0da42"}}, 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">>}, From bf4ec9a45d057548f5112263ec2b9ab151daeec0 Mon Sep 17 00:00:00 2001 From: ttt161 Date: Wed, 18 Mar 2026 18:54:49 +0300 Subject: [PATCH 2/6] fix typo --- config/sys.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/sys.config b/config/sys.config index 58a8e2d3..f25d11b8 100644 --- a/config/sys.config +++ b/config/sys.config @@ -267,7 +267,7 @@ 'ff/withdrawal/session_v2' ] ]} - }}, + }} ]}, {snowflake, [ From 4c0cc9061c4a27e6cb7f864567375573af745f0f Mon Sep 17 00:00:00 2001 From: ttt161 Date: Thu, 19 Mar 2026 09:53:36 +0300 Subject: [PATCH 3/6] trace error unification --- apps/fistful/src/ff_machine.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/fistful/src/ff_machine.erl b/apps/fistful/src/ff_machine.erl index 015b9fbb..5a2d29de 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); + %% json_compatible_value(Reason); + unicode:characters_to_binary(io_lib:format("~p", [Reason])); extract_error(_) -> null. From 56cc3dbab21741a88f3b8efe38ef8fc583f4ab0c Mon Sep 17 00:00:00 2001 From: ttt161 Date: Thu, 19 Mar 2026 10:00:01 +0300 Subject: [PATCH 4/6] bump machinery --- apps/fistful/src/ff_machine.erl | 2 +- rebar.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/fistful/src/ff_machine.erl b/apps/fistful/src/ff_machine.erl index 5a2d29de..30852d52 100644 --- a/apps/fistful/src/ff_machine.erl +++ b/apps/fistful/src/ff_machine.erl @@ -176,7 +176,7 @@ 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/rebar.lock b/rebar.lock index 9cd09edb..1f02f16b 100644 --- a/rebar.lock +++ b/rebar.lock @@ -76,7 +76,7 @@ 0}, {<<"machinery">>, {git,"https://github.com/valitydev/machinery-erlang.git", - {ref,"0b992112c083330546f7365783d86f8817fbe9fa"}}, + {ref,"a8f4f13eb7811cef13ba1c3cc34035f3e2613b4f"}}, 0}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"mg_proto">>, @@ -100,7 +100,7 @@ 0}, {<<"progressor">>, {git,"https://github.com/valitydev/progressor.git", - {ref,"3b6abfb2e6dd94e508646c67837f7d5993c0da42"}}, + {ref,"90f46570007a1cbf7cac960059fe6c8018702489"}}, 1}, {<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.11.0">>},0}, {<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.9">>},0}, From 81db09117d959d19adea6fbf4e9965ba4e3447c7 Mon Sep 17 00:00:00 2001 From: ttt161 Date: Thu, 19 Mar 2026 10:48:59 +0300 Subject: [PATCH 5/6] fix tests --- .../test/ff_withdrawal_session_repair_SUITE.erl | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) 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">> } From 87be85f62d182a1266b6b5228d0c035037f528e8 Mon Sep 17 00:00:00 2001 From: ttt161 Date: Thu, 19 Mar 2026 10:59:47 +0300 Subject: [PATCH 6/6] bump machinery-1.1.21 --- rebar.config | 2 +- rebar.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index 24d48176..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", {branch, "epic/graceful-shutdown"}}}, + {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 1f02f16b..7e0969b9 100644 --- a/rebar.lock +++ b/rebar.lock @@ -76,7 +76,7 @@ 0}, {<<"machinery">>, {git,"https://github.com/valitydev/machinery-erlang.git", - {ref,"a8f4f13eb7811cef13ba1c3cc34035f3e2613b4f"}}, + {ref,"24982b9ae38e029d23b724b0cbf7105c1ad978c9"}}, 0}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"mg_proto">>,