diff --git a/apps/ff_server/src/ff_machine_handler.erl b/apps/ff_server/src/ff_machine_handler.erl new file mode 100644 index 00000000..07a2568b --- /dev/null +++ b/apps/ff_server/src/ff_machine_handler.erl @@ -0,0 +1,44 @@ +-module(ff_machine_handler). + +-export([init/2, terminate/3]). +-export([get_routes/0]). + +-spec get_routes() -> _. +get_routes() -> + [ + {"/traces/internal/source_v1/[:process_id]", ?MODULE, #{namespace => 'ff/source_v1'}}, + {"/traces/internal/destination_v2/[:process_id]", ?MODULE, #{namespace => 'ff/destination_v2'}}, + {"/traces/internal/deposit_v1/[:process_id]", ?MODULE, #{namespace => 'ff/deposit_v1'}}, + {"/traces/internal/withdrawal_v2/[:process_id]", ?MODULE, #{namespace => 'ff/withdrawal_v2'}}, + {"/traces/internal/withdrawal_session_v2/[:process_id]", ?MODULE, #{namespace => 'ff/withdrawal/session_v2'}} + ]. + +-spec init(cowboy_req:req(), cowboy_http:opts()) -> + {ok, cowboy_req:req(), undefined}. +init(Request, Opts) -> + Method = cowboy_req:method(Request), + NS = maps:get(namespace, Opts), + ProcessID = cowboy_req:binding(process_id, Request), + maybe + {method_is_valid, true} ?= {method_is_valid, Method =:= <<"GET">>}, + {process_id_is_valid, true} ?= {process_id_is_valid, is_binary(ProcessID)}, + {ok, Trace} ?= ff_machine:trace(NS, ProcessID), + Body = unicode:characters_to_binary(json:encode(Trace)), + Req = cowboy_req:reply(200, #{}, Body, Request), + {ok, Req, undefined} + else + {method_is_valid, false} -> + Req1 = cowboy_req:reply(405, #{}, <<"Method Not Allowed">>, Request), + {ok, Req1, undefined}; + {process_id_is_valid, false} -> + Req2 = cowboy_req:reply(400, #{}, <<"Invalid ProcessID">>, Request), + {ok, Req2, undefined}; + {error, <<"process not found">>} -> + Req3 = cowboy_req:reply(404, #{}, <<"Unknown process">>, Request), + {ok, Req3, undefined} + end. + +-spec terminate(term(), cowboy_req:req(), undefined) -> + ok. +terminate(_Reason, _Req, _State) -> + ok. diff --git a/apps/ff_server/src/ff_server.erl b/apps/ff_server/src/ff_server.erl index e3ae076e..1a9f6123 100644 --- a/apps/ff_server/src/ff_server.erl +++ b/apps/ff_server/src/ff_server.erl @@ -97,7 +97,7 @@ init([]) -> handlers => WoodyHandlers, event_handler => ff_woody_event_handler, additional_routes => - get_prometheus_routes() ++ + get_prometheus_routes() ++ ff_machine_handler:get_routes() ++ [erl_health_handle:get_route(enable_health_logging(HealthCheck))] } ) diff --git a/apps/ff_server/test/ff_deposit_handler_SUITE.erl b/apps/ff_server/test/ff_deposit_handler_SUITE.erl index 17c8695b..b5d9d84d 100644 --- a/apps/ff_server/test/ff_deposit_handler_SUITE.erl +++ b/apps/ff_server/test/ff_deposit_handler_SUITE.erl @@ -30,6 +30,7 @@ -export([unknown_test/1]). -export([get_context_test/1]). -export([get_events_test/1]). +-export([trace_deposit_ok_test/1]). %% Internal types @@ -56,7 +57,8 @@ groups() -> create_negative_ok_test, unknown_test, get_context_test, - get_events_test + get_events_test, + trace_deposit_ok_test ]} ]. @@ -221,6 +223,58 @@ create_ok_test(_C) -> ff_codec:unmarshal(timestamp_ms, DepositState#deposit_DepositState.created_at) ). +-spec trace_deposit_ok_test(config()) -> test_return(). +trace_deposit_ok_test(_C) -> + Body = make_cash({100, <<"RUB">>}), + #{ + party_id := PartyID, + wallet_id := WalletID, + source_id := SourceID + } = ct_objects:prepare_standard_environment(ct_objects:build_default_ctx()), + DepositID = genlib:bsuuid(), + ExternalID = genlib:bsuuid(), + Context = #{<<"NS">> => #{genlib:bsuuid() => genlib:bsuuid()}}, + Metadata = ff_entity_context_codec:marshal(#{<<"metadata">> => #{<<"some key">> => <<"some data">>}}), + Description = <<"testDesc">>, + Params = #deposit_DepositParams{ + id = DepositID, + party_id = PartyID, + body = Body, + source_id = SourceID, + wallet_id = WalletID, + metadata = Metadata, + external_id = ExternalID, + description = Description + }, + {ok, _DepositState} = call_deposit('Create', {Params, ff_entity_context_codec:marshal(Context)}), + timer:sleep(1000), + TraceUrl = <<"http://localhost:8022/traces/internal/deposit_v1/", DepositID/binary>>, + {ok, 200, _Headers, Ref} = hackney:get(TraceUrl), + {ok, TraceBody} = hackney:body(Ref), + [ + #{ + <<"args">> := [ + [ + #{<<"created">> := _}, + #{<<"status_changed">> := <<"pending">>} + ], + #{<<"NS">> := _} + ], + <<"events">> := [ + #{<<"event_id">> := 1, <<"event_payload">> := #{<<"created">> := _}, <<"event_timestamp">> := _}, + #{<<"event_id">> := 2, <<"event_payload">> := #{<<"status_changed">> := _}, <<"event_timestamp">> := _} + ], + <<"task_status">> := <<"finished">>, + <<"task_type">> := <<"init">> + }, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>}, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>}, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>}, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>}, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>} + ] = json:decode(TraceBody), + ok. + -spec create_negative_ok_test(config()) -> test_return(). create_negative_ok_test(_C) -> Body = make_cash({-100, <<"RUB">>}), diff --git a/apps/ff_server/test/ff_destination_handler_SUITE.erl b/apps/ff_server/test/ff_destination_handler_SUITE.erl index 00ef6baa..c5a740ab 100644 --- a/apps/ff_server/test/ff_destination_handler_SUITE.erl +++ b/apps/ff_server/test/ff_destination_handler_SUITE.erl @@ -19,6 +19,7 @@ -export([create_ripple_wallet_destination_ok/1]). -export([create_digital_wallet_destination_ok/1]). -export([create_generic_destination_ok/1]). +-export([trace_destination_test/1]). -type config() :: ct_helper:config(). -type test_case_name() :: ct_helper:test_case_name(). @@ -37,7 +38,8 @@ groups() -> create_crypto_wallet_destination_ok, create_ripple_wallet_destination_ok, create_digital_wallet_destination_ok, - create_generic_destination_ok + create_generic_destination_ok, + trace_destination_test ]} ]. @@ -139,6 +141,42 @@ create_generic_destination_ok(C) -> }}, create_destination_ok(Resource, C). +-spec trace_destination_test(config()) -> test_return(). +trace_destination_test(C) -> + Resource = + {bank_card, #'fistful_base_ResourceBankCard'{ + bank_card = #'fistful_base_BankCard'{ + token = <<"TOKEN shmOKEN">> + } + }}, + AuthData = + {sender_receiver, #destination_SenderReceiverAuthData{ + sender = <<"SenderToken">>, + receiver = <<"ReceiverToken">> + }}, + {ok, #destination_DestinationState{id = ID}} = create_destination_ok(AuthData, Resource, C), + TraceUrl = <<"http://localhost:8022/traces/internal/destination_v2/", ID/binary>>, + {ok, 200, _Headers, Ref} = hackney:get(TraceUrl), + {ok, Body} = hackney:body(Ref), + [ + #{ + <<"args">> := [ + [ + #{<<"created">> := _}, + #{<<"account">> := _} + ], + #{<<"NS">> := #{}} + ], + <<"events">> := [ + #{<<"event_id">> := 1, <<"event_payload">> := #{<<"created">> := _}, <<"event_timestamp">> := _}, + #{<<"event_id">> := 2, <<"event_payload">> := #{<<"account">> := _}, <<"event_timestamp">> := _} + ], + <<"task_status">> := <<"finished">>, + <<"task_type">> := <<"init">> + } + ] = json:decode(Body), + ok. + %%---------------------------------------------------------------------- %% Internal functions %%---------------------------------------------------------------------- diff --git a/apps/ff_server/test/ff_source_handler_SUITE.erl b/apps/ff_server/test/ff_source_handler_SUITE.erl index 6c45c443..c87b9905 100644 --- a/apps/ff_server/test/ff_source_handler_SUITE.erl +++ b/apps/ff_server/test/ff_source_handler_SUITE.erl @@ -19,6 +19,7 @@ -export([get_source_context_ok_test/1]). -export([create_source_ok_test/1]). -export([unknown_test/1]). +-export([trace_source_ok_test/1]). -type config() :: ct_helper:config(). -type test_case_name() :: ct_helper:test_case_name(). @@ -36,7 +37,8 @@ groups() -> get_source_events_ok_test, get_source_context_ok_test, create_source_ok_test, - unknown_test + unknown_test, + trace_source_ok_test ]} ]. @@ -104,6 +106,37 @@ create_source_ok_test(C) -> }}, create_source_ok(Resource, C). +-spec trace_source_ok_test(config()) -> test_return(). +trace_source_ok_test(C) -> + Resource = + {internal, #source_Internal{ + details = <<"details">> + }}, + State = create_source_ok(Resource, C), + ID = State#source_SourceState.id, + TraceUrl = <<"http://localhost:8022/traces/internal/source_v1/", ID/binary>>, + {ok, 200, _Headers, Ref} = hackney:get(TraceUrl), + {ok, Body} = hackney:body(Ref), + [ + #{ + <<"args">> := [ + [ + #{<<"created">> := _}, + #{<<"account">> := _} + ], + #{<<"NS">> := #{}} + ], + <<"events">> := [ + #{<<"event_id">> := 1, <<"event_payload">> := #{<<"created">> := _}, <<"event_timestamp">> := _}, + #{<<"event_id">> := 2, <<"event_payload">> := #{<<"account">> := _}, <<"event_timestamp">> := _} + ], + <<"task_status">> := <<"finished">>, + <<"task_type">> := <<"init">> + }, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>} + ] = json:decode(Body), + ok. + -spec unknown_test(config()) -> test_return(). unknown_test(_C) -> ID = <<"unknown_id">>, diff --git a/apps/ff_server/test/ff_withdrawal_handler_SUITE.erl b/apps/ff_server/test/ff_withdrawal_handler_SUITE.erl index 1169afb1..c5f62112 100644 --- a/apps/ff_server/test/ff_withdrawal_handler_SUITE.erl +++ b/apps/ff_server/test/ff_withdrawal_handler_SUITE.erl @@ -43,6 +43,7 @@ -export([create_adjustment_already_has_status_error_test/1]). -export([create_adjustment_already_has_data_revision_error_test/1]). -export([withdrawal_state_content_test/1]). +-export([trace_withdrawal_test/1]). -type config() :: ct_helper:config(). -type test_case_name() :: ct_helper:test_case_name(). @@ -283,6 +284,82 @@ create_withdrawal_ok_test(_C) -> FinalWithdrawalState#wthd_WithdrawalState.status ). +-spec trace_withdrawal_test(config()) -> test_return(). +trace_withdrawal_test(_C) -> + Cash = make_cash({1000, <<"RUB">>}), + Ctx = ct_objects:build_default_ctx(), + #{ + party_id := PartyID, + wallet_id := WalletID, + destination_id := DestinationID + } = ct_objects:prepare_standard_environment(Ctx#{body => Cash}), + WithdrawalID = genlib:bsuuid(), + ExternalID = genlib:bsuuid(), + Context = ff_entity_context_codec:marshal(#{<<"NS">> => #{}}), + Metadata = ff_entity_context_codec:marshal(#{<<"metadata">> => #{<<"some key">> => <<"some data">>}}), + ContactInfo = #fistful_base_ContactInfo{ + phone_number = <<"1234567890">>, + email = <<"test@mail.com">> + }, + Params = #wthd_WithdrawalParams{ + id = WithdrawalID, + party_id = PartyID, + wallet_id = WalletID, + destination_id = DestinationID, + body = Cash, + metadata = Metadata, + external_id = ExternalID, + contact_info = ContactInfo + }, + {ok, _WithdrawalState} = call_withdrawal('Create', {Params, Context}), + succeeded = ct_objects:await_final_withdrawal_status(WithdrawalID), + + TraceUrl = <<"http://localhost:8022/traces/internal/withdrawal_v2/", WithdrawalID/binary>>, + {ok, 200, _Headers, Ref} = hackney:get(TraceUrl), + {ok, Body} = hackney:body(Ref), + [ + #{ + <<"args">> := [ + [ + #{<<"created">> := _}, + #{<<"status_changed">> := <<"pending">>}, + #{<<"resource_got">> := #{<<"bank_card">> := _}} + ], + #{<<"NS">> := #{}} + ], + <<"error">> := null, + <<"events">> := [ + #{<<"event_id">> := 1, <<"event_timestamp">> := _, <<"event_payload">> := #{<<"created">> := _}}, + #{<<"event_id">> := 2, <<"event_timestamp">> := _, <<"event_payload">> := #{<<"status_changed">> := _}}, + #{<<"event_id">> := 3, <<"event_timestamp">> := _, <<"event_payload">> := #{<<"resource_got">> := _}} + ], + <<"finished">> := _, + <<"otel_trace_id">> := _, + <<"retry_attempts">> := _, + <<"retry_interval">> := _, + <<"running">> := _, + <<"scheduled">> := _, + <<"task_id">> := _, + <<"task_metadata">> := #{<<"range">> := #{}}, + <<"task_status">> := <<"finished">>, + <<"task_type">> := <<"init">> + }, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>}, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>}, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>}, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>}, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>}, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>}, + #{ + <<"args">> := #{<<"notify">> := [<<"session_finished">> | _]}, + <<"task_status">> := <<"finished">>, + <<"task_type">> := <<"call">> + }, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>}, + #{<<"task_status">> := <<"finished">>, <<"task_type">> := <<"timeout">>} + ] = json:decode(Body), + ok. + -spec create_withdrawal_fail_email_test(config()) -> test_return(). create_withdrawal_fail_email_test(_C) -> Cash = make_cash({1000, <<"RUB">>}), 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 37c246e3..fb297c21 100644 --- a/apps/ff_server/test/ff_withdrawal_session_repair_SUITE.erl +++ b/apps/ff_server/test/ff_withdrawal_session_repair_SUITE.erl @@ -124,7 +124,72 @@ repair_failed_session_with_failure(C) -> {failed, #{ code => SessionID }}, - ?assertMatch({finished, Expected}, get_session_status(SessionID)). + ?assertMatch({finished, Expected}, get_session_status(SessionID)), + timer:sleep(1000), + TraceUrl = <<"http://localhost:8022/traces/internal/withdrawal_session_v2/", SessionID/binary>>, + {ok, 200, _Headers, Ref} = hackney:get(TraceUrl), + {ok, Body} = hackney:body(Ref), + [ + #{ + <<"args">> := [#{<<"created">> := _}], + <<"error">> := null, + <<"events">> := [ + #{ + <<"event_id">> := 1, + <<"event_payload">> := #{<<"created">> := _}, + <<"event_timestamp">> := _ + } + ], + <<"finished">> := _, + <<"otel_trace_id">> := null, + <<"retry_attempts">> := 0, + <<"retry_interval">> := 0, + <<"running">> := _, + <<"scheduled">> := _, + <<"task_id">> := _, + <<"task_metadata">> := #{<<"range">> := #{}}, + <<"task_status">> := <<"finished">>, + <<"task_type">> := <<"init">> + }, + #{ + %% MAYBE io_lib:format instead of json compatible value + <<"error">> := [ + <<"exception">>, + <<"error">>, + #{<<"badmatch">> := #{<<"error">> := <<"notfound">>}} + ], + <<"task_status">> := <<"error">>, + <<"task_type">> := <<"timeout">> + }, + #{ + <<"args">> := #{ + <<"set_session_result">> := #{<<"failed">> := #{<<"code">> := _}} + }, + <<"error">> := null, + <<"events">> := [ + #{ + <<"event_id">> := 2, + <<"event_payload">> := #{ + <<"finished">> := #{<<"failed">> := #{<<"code">> := _}} + }, + <<"event_timestamp">> := _ + } + ], + <<"task_status">> := <<"finished">>, + <<"task_type">> := <<"repair">> + }, + #{ + %% Error because can`t notify withdrawal machine + <<"error">> := [ + <<"exception">>, + <<"error">>, + #{<<"unable_to_finish_session">> := #{<<"error">> := <<"notfound">>}} + ], + <<"task_status">> := <<"error">>, + <<"task_type">> := <<"timeout">> + } + ] = json:decode(Body), + ok. %% Internals diff --git a/apps/fistful/src/ff_machine.erl b/apps/fistful/src/ff_machine.erl index d00eb282..015b9fbb 100644 --- a/apps/fistful/src/ff_machine.erl +++ b/apps/fistful/src/ff_machine.erl @@ -55,6 +55,7 @@ -export([get/3]). -export([get/4]). +-export([trace/2]). -export([collapse/2]). -export([history/4]). @@ -101,6 +102,8 @@ %% +-define(EPOCH_DIFF, 62167219200). + -spec model(st(Model)) -> Model. -spec ctx(st(_)) -> ctx(). -spec created(st(_)) -> timestamp() | undefined. @@ -138,6 +141,151 @@ get(Mod, NS, ID, Range) -> collapse(Mod, Machine) end). +-spec trace(namespace(), id()) -> _. +trace(NS, ID) -> + maybe + {ok, MachineTrace} ?= machinery:trace(NS, ID, fistful:backend(NS)), + Trace = unmarshal_trace(MachineTrace), + {ok, Trace} + else + {error, _} = Error -> + Error + end. + +unmarshal_trace(MachineTrace) -> + lists:map(fun(TraceUnit) -> unmarshal_trace_unit(TraceUnit) end, MachineTrace). + +unmarshal_trace_unit(TraceUnit) -> + MachineArgs = maps:get(args, TraceUnit, undefined), + MachineEvents = maps:get(events, TraceUnit, []), + OtelTraceID = extract_trace_id(TraceUnit), + Error = extract_error(TraceUnit), + maps:merge( + maps:without([response, context], TraceUnit), + #{ + args => json_compatible_value(MachineArgs), + events => unmarshal_machine_events(MachineEvents), + otel_trace_id => OtelTraceID, + error => Error + } + ). + +extract_trace_id(#{context := #{<<"otel">> := [OtelTraceID | _]}}) -> + OtelTraceID; +extract_trace_id(_) -> + null. + +extract_error(#{response := {error, Reason}}) -> + json_compatible_value(Reason); +extract_error(_) -> + null. + +json_compatible_value([]) -> + []; +json_compatible_value(V) when is_list(V) -> + case io_lib:printable_unicode_list(V) of + true -> + unicode:characters_to_binary(V); + false -> + [json_compatible_value(E) || E <- V] + end; +json_compatible_value(V) when is_map(V) -> + maps:fold( + fun(K, Val, Acc) -> + Acc#{json_compatible_key(K) => json_compatible_value(Val)} + end, + #{}, + V + ); +%% tagged tuple - special case or not??? +json_compatible_value({K, V}) when is_atom(K) -> + #{K => json_compatible_value(V)}; +json_compatible_value(V) when is_tuple(V) -> + %% MAYBE ??? + %% Elements = [json_compatible_value(E) || E <- tuple_to_list(V)], + %% #{<<"__tuple__">> => Elements}; + [json_compatible_value(E) || E <- tuple_to_list(V)]; +json_compatible_value(true) -> + true; +json_compatible_value(false) -> + false; +json_compatible_value(null) -> + null; +json_compatible_value(undefined) -> + null; +json_compatible_value(V) when is_atom(V) -> + erlang:atom_to_binary(V); +json_compatible_value(V) when is_integer(V) -> + V; +json_compatible_value(V) when is_float(V) -> + V; +json_compatible_value(V) when is_binary(V) -> + try unicode:characters_to_binary(V) of + Binary when is_binary(Binary) -> + Binary; + _ -> + content(<<"base64">>, base64:encode(V)) + catch + _:_ -> + content(<<"base64">>, base64:encode(V)) + end; +%% default for other types (pid() | ref() | function() etc) +json_compatible_value(V) -> + CompatVal = unicode:characters_to_binary(io_lib:format("~p", [V])), + content(<<"unknown">>, CompatVal). + +json_compatible_key(K) when + is_atom(K); + is_integer(K); + is_float(K) +-> + K; +json_compatible_key(K) when is_list(K) -> + case io_lib:printable_unicode_list(K) of + true -> + unicode:characters_to_binary(K); + false -> + unicode:characters_to_binary(io_lib:format("~p", [K])) + end; +json_compatible_key(K) when is_binary(K) -> + try unicode:characters_to_binary(K) of + Binary when is_binary(Binary) -> + Binary; + _ -> + base64:encode(K) + %% MAYBE ??? + %% unicode:characters_to_binary(io_lib:format("~p", [K])) + catch + _:_ -> + base64:encode(K) + %% MAYBE ??? + %% unicode:characters_to_binary(io_lib:format("~p", [K])) + end; +json_compatible_key(K) -> + unicode:characters_to_binary(io_lib:format("~p", [K])). + +content(Type, Payload) -> + #{ + <<"content_type">> => Type, + <<"content">> => Payload + }. + +unmarshal_machine_events(MachineEvents) -> + lists:map( + fun({EventID, _TsExt, {ev, Ts, Body}}) -> + #{ + event_id => EventID, + event_payload => json_compatible_value(Body), + event_timestamp => to_unix_microseconds(Ts) + } + end, + MachineEvents + ). + +to_unix_microseconds({{{_Y, _M, _D}, {_H, _Min, _S}} = DateTime, Microsec}) -> + GregorianSeconds = calendar:datetime_to_gregorian_seconds(DateTime), + (GregorianSeconds - ?EPOCH_DIFF) * 1000000 + Microsec. + -spec history(module(), namespace(), id(), range()) -> {ok, history()} | {error, notfound}. diff --git a/apps/fistful/src/fistful.erl b/apps/fistful/src/fistful.erl index c1f381a6..443412e6 100644 --- a/apps/fistful/src/fistful.erl +++ b/apps/fistful/src/fistful.erl @@ -23,6 +23,7 @@ -export([repair/5]). -export([notify/5]). -export([remove/3]). +-export([trace/3]). -export([init/4]). -export([process_timeout/3]). @@ -70,6 +71,10 @@ notify(NS, ID, Range, Args, Backend) -> remove(NS, ID, Backend) -> machinery:remove(NS, ID, set_backend_context(Backend)). +-spec trace(namespace(), id(), machinery:backend(_)) -> _. +trace(NS, ID, Backend) -> + machinery:trace(NS, ID, Backend). + %% -type handler_opts() :: machinery:handler_opts(#{ diff --git a/apps/machinery_extra/src/machinery_gensrv_backend.erl b/apps/machinery_extra/src/machinery_gensrv_backend.erl index 52ed3d44..6db3e3bc 100644 --- a/apps/machinery_extra/src/machinery_gensrv_backend.erl +++ b/apps/machinery_extra/src/machinery_gensrv_backend.erl @@ -40,6 +40,7 @@ -export([get/4]). -export([notify/5]). -export([remove/3]). +-export([trace/3]). %% Gen Server @@ -134,6 +135,10 @@ notify(_NS, _ID, _Range, _Args, _Opts) -> remove(_Namespace, _ID, _Opts) -> erlang:error({not_implemented, remove}). +-spec trace(namespace(), id(), backend_opts()) -> no_return(). +trace(_Namespace, _ID, _Opts) -> + erlang:error({not_implemented, trace}). + %% Gen Server + Supervisor -spec start_machine_link(logic_handler(_), namespace(), id(), args(_)) -> {ok, pid()}. diff --git a/compose.yaml b/compose.yaml index 6502ede3..ede962f0 100644 --- a/compose.yaml +++ b/compose.yaml @@ -133,6 +133,8 @@ services: environment: POSTGRES_MULTIPLE_DATABASES: "fistful,bender,dmt,party_management,shumway,liminator" POSTGRES_PASSWORD: "postgres" + ports: + - "5432:5432" volumes: - ./test/postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d healthcheck: diff --git a/rebar.config b/rebar.config index e1afca40..f25b7ebf 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.19"}}}, + {machinery, {git, "https://github.com/valitydev/machinery-erlang.git", {tag, "v1.1.20"}}}, {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 0fcdeb3b..d014f76f 100644 --- a/rebar.lock +++ b/rebar.lock @@ -71,7 +71,7 @@ 0}, {<<"machinery">>, {git,"https://github.com/valitydev/machinery-erlang.git", - {ref,"eac35324e9adc7bfc52e7bb83148335cba01fee8"}}, + {ref,"5b3ad0c039c447eee6dec71ce6a5dce5538c8ec7"}}, 0}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"mg_proto">>, @@ -95,7 +95,7 @@ 0}, {<<"progressor">>, {git,"https://github.com/valitydev/progressor.git", - {ref,"6033631d3e1eb9593acf7841d8a635146ff482e8"}}, + {ref,"c55edd1846eaa08774f0ddfd575cec06affc70ac"}}, 1}, {<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.11.0">>},0}, {<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.9">>},0},