diff --git a/apps/hellgate/src/hellgate.erl b/apps/hellgate/src/hellgate.erl index 751f180b..23a6529e 100644 --- a/apps/hellgate/src/hellgate.erl +++ b/apps/hellgate/src/hellgate.erl @@ -64,6 +64,7 @@ get_api_child_spec(MachineHandlers, Opts) -> construct_health_routes(readiness, genlib_app:env(?MODULE, health_check_readiness, #{})), EventHandlerOpts = genlib_app:env(?MODULE, scoper_event_handler_options, #{}), PrometeusRoute = get_prometheus_route(), + ProcessTracingRoute = hg_progressor_handler:get_routes(), woody_server:child_spec( ?MODULE, #{ @@ -78,7 +79,7 @@ get_api_child_spec(MachineHandlers, Opts) -> construct_service_handler(invoice_templating, hg_invoice_template, Opts), construct_service_handler(proxy_host_provider, hg_proxy_host_provider, Opts) ], - additional_routes => [PrometeusRoute | HealthRoutes], + additional_routes => [PrometeusRoute | HealthRoutes] ++ ProcessTracingRoute, shutdown_timeout => genlib_app:env(?MODULE, shutdown_timeout, 0) } ). diff --git a/apps/hellgate/src/hg_invoice.erl b/apps/hellgate/src/hg_invoice.erl index 37e652b9..64534781 100644 --- a/apps/hellgate/src/hg_invoice.erl +++ b/apps/hellgate/src/hg_invoice.erl @@ -40,6 +40,7 @@ -export([get_payment_opts/1]). -export([create/6]). -export([marshal_invoice/1]). +-export([unmarshal_invoice/1]). -export([unmarshal_history/1]). -export([collapse_history/1]). diff --git a/apps/hellgate/src/hg_invoice_template.erl b/apps/hellgate/src/hg_invoice_template.erl index 7c178e0b..addd13ca 100644 --- a/apps/hellgate/src/hg_invoice_template.erl +++ b/apps/hellgate/src/hg_invoice_template.erl @@ -26,6 +26,7 @@ %% API -export([get/1]). +-export([unmarshal_invoice_template_params/1]). -type tpl_id() :: dmsl_domain_thrift:'InvoiceTemplateID'(). -type tpl() :: dmsl_domain_thrift:'InvoiceTemplate'(). diff --git a/apps/hellgate/test/hg_invoice_lite_tests_SUITE.erl b/apps/hellgate/test/hg_invoice_lite_tests_SUITE.erl index 21e72b01..628533a5 100644 --- a/apps/hellgate/test/hg_invoice_lite_tests_SUITE.erl +++ b/apps/hellgate/test/hg_invoice_lite_tests_SUITE.erl @@ -60,7 +60,8 @@ groups() -> {group, pool_payments} ]}, {pool_payments, [parallel], lists:foldl(fun(_, Acc) -> [payment_ok_test | Acc] end, [], lists:seq(1, 100))}, - {payments, [parallel], [ + {payments, [], [payment_success]}, + {paymentsx, [parallel], [ payment_start_idempotency, payment_success, payment_w_first_blacklisted_success, @@ -241,6 +242,43 @@ payment_success(C) -> }, Payment ), + + RootUrl = unicode:characters_to_binary(cfg(root_url, C)), + FullUrl = <>, + {ok, _Status, _Headers, Ref} = hackney:get(FullUrl), + {ok, Body} = hackney:body(Ref), + [ + #{ + <<"args">> := _, + <<"error">> := null, + <<"events">> := _, + <<"finished">> := _, + <<"otel_trace_id">> := _, + <<"retry_attempts">> := 0, + <<"retry_interval">> := 0, + <<"running">> := _, + <<"scheduled">> := _, + <<"task_id">> := _, + <<"task_metadata">> := #{<<"range">> := #{}}, + <<"task_status">> := <<"finished">>, + <<"task_type">> := <<"init">> + }, + _, + _, + _, + _, + _, + _, + _, + _, + _, + _, + _, + _, + _, + _ + ] = json:decode(Body), + ?assertMatch( #domain_TransactionInfo{ extra = #{ diff --git a/apps/hg_progressor/src/hg_progressor_handler.erl b/apps/hg_progressor/src/hg_progressor_handler.erl new file mode 100644 index 00000000..bfce0e22 --- /dev/null +++ b/apps/hg_progressor/src/hg_progressor_handler.erl @@ -0,0 +1,377 @@ +-module(hg_progressor_handler). + +-export([init/2, terminate/3]). +-export([get_routes/0]). + +-spec get_routes() -> _. +get_routes() -> + [ + {"/traces/[:format]/invoice/[:process_id]", ?MODULE, #{namespace => invoice}}, + {"/traces/[:format]/invoice_template/[:process_id]", ?MODULE, #{namespace => invoice_template}} + ]. + +-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), + Format = cowboy_req:binding(format, Request), + ProcessID = cowboy_req:binding(process_id, Request), + Req = handle(Method, NS, ProcessID, Format, Request), + {ok, Req, undefined}. + +-spec terminate(term(), cowboy_req:req(), undefined) -> + ok. +terminate(_Reason, _Req, _State) -> + ok. + +-spec handle(_, _, _, _, _) -> _. +handle(<<"GET">>, NS, ProcessID, Format, Request) -> + case progressor:trace(#{ns => NS, id => ProcessID}) of + {ok, RawTrace} -> + Trace = unmarshal_trace(NS, ProcessID, RawTrace, Format), + Body = unicode:characters_to_binary(json:encode(Trace)), + cowboy_req:reply(200, #{}, Body, Request); + {error, _} = _Error -> + cowboy_req:reply(404, #{}, <<"Unknown process">>, Request) + end; +handle(_, _NS, _ProcessID, _Format, Request) -> + cowboy_req:reply(405, #{}, <<"Method Not Allowed">>, Request). + +unmarshal_trace(NS, ProcessID, RawTrace, <<"internal">> = Format) -> + lists:map(fun(RawTraceUnit) -> unmarshal_trace_unit(NS, ProcessID, RawTraceUnit, Format) end, RawTrace); +unmarshal_trace(NS, ProcessID, RawTrace, <<"jaeger">> = Format) -> + Spans = lists:map(fun(RawTraceUnit) -> unmarshal_trace_unit(NS, ProcessID, RawTraceUnit, Format) end, RawTrace), + #{ + data => [ + #{ + traceID => trace_id(NS, ProcessID), + spans => Spans, + processes => #{ + ProcessID => #{ + service_name => service_name(NS), + tags => [] + } + } + } + ] + }. + +unmarshal_trace_unit(NS, _ProcessID, #{task_type := TaskType} = TraceUnit, <<"internal">> = Format) -> + BinArgs = maps:get(args, TraceUnit, <<>>), + BinEvents = maps:get(events, TraceUnit, []), + OtelTraceID = extract_trace_id(TraceUnit), + Error = extract_error(TraceUnit), + (maps:without([response, context], TraceUnit))#{ + args => unmarshal_args(NS, TaskType, BinArgs), + events => unmarshal_events(BinEvents, Format), + otel_trace_id => OtelTraceID, + error => Error + }; +unmarshal_trace_unit(NS, ProcessID, #{task_type := TaskType, task_id := TaskID} = TraceUnit, <<"jaeger">> = Format) -> + BinArgs = maps:get(args, TraceUnit, <<>>), + BinEvents = maps:get(events, TraceUnit, []), + #{ + processID => ProcessID, + process => #{ + service_name => service_name(NS), + tags => [] + }, + warnings => [], + traceId => trace_id(NS, ProcessID), + span_id => integer_to_binary(TaskID), + operationName => TaskType, + startTime => start_time(TraceUnit), + duration => duration(TraceUnit), + tags => [ + #{ + key => <<"task.status">>, + type => <<"string">>, + value => maps:get(task_status, TraceUnit) + }, + #{ + key => <<"task.retries">>, + type => <<"int64">>, + value => maps:get(retry_attempts, TraceUnit) + }, + #{ + key => <<"task.input">>, + type => <<"string">>, + value => unicode:characters_to_binary(json:encode(unmarshal_args(NS, TaskType, BinArgs))) + } + ] ++ error_tag(TraceUnit), + logs => unmarshal_events(BinEvents, Format) + }. + +unmarshal_args(_, _, <<>>) -> + <<>>; +unmarshal_args(invoice, <<"init">> = _TaskType, BinArgs) -> + {bin, B} = binary_to_term(BinArgs), + UnwrappedArgs = binary_to_term(B), + Type = {struct, struct, {dmsl_domain_thrift, 'Invoice'}}, + Args = hg_invoice:unmarshal_invoice(UnwrappedArgs), + #{ + content_type => <<"thrift_call">>, + content => #{ + call => #{service => 'Invoicing', function => 'Create'}, + params => to_maps(term_to_object(Args, Type)) + } + }; +unmarshal_args(invoice_template, <<"init">> = _TaskType, BinArgs) -> + {bin, B} = binary_to_term(BinArgs), + UnwrappedArgs = binary_to_term(B), + Type = {struct, struct, {dmsl_payproc_thrift, 'InvoiceTemplateCreateParams'}}, + Args = hg_invoice_template:unmarshal_invoice_template_params(UnwrappedArgs), + #{ + content_type => <<"thrift_call">>, + content => #{ + call => #{service => 'InvoiceTemplating', function => 'Create'}, + params => to_maps(term_to_object(Args, Type)) + } + }; +unmarshal_args(_, TaskType, BinArgs) when + TaskType =:= <<"call">>; + TaskType =:= <<"repair">>; + TaskType =:= <<"timeout">> +-> + {bin, B} = binary_to_term(BinArgs), + case binary_to_term(B) of + {schemaless_call, Args} -> + maybe_format(Args); + {thrift_call, ServiceName, FunctionRef, EncodedArgs} -> + {Service, Function} = FunctionRef, + {Module, Service} = hg_proto:get_service(ServiceName), + Type = Module:function_info(Service, Function, params_type), + Args = hg_proto_utils:deserialize(Type, EncodedArgs), + #{ + content_type => <<"thrift_call">>, + content => #{ + call => #{service => Service, function => Function}, + params => to_maps(term_to_object(Args, Type)) + } + }; + Args -> + maybe_format(Args) + end. + +unmarshal_events(BinEvents, Format) -> + lists:map( + fun(#{event_payload := BinPayload} = Event) -> + {bin, BinChanges} = binary_to_term(BinPayload), + Type = {struct, union, {dmsl_payproc_thrift, 'EventPayload'}}, + Changes = hg_proto_utils:deserialize(Type, BinChanges), + Payload = to_maps(term_to_object(Changes, Type)), + unmarshal_event(Event, Payload, Format) + end, + BinEvents + ). + +unmarshal_event(Event, Payload, <<"internal">>) -> + Event#{event_payload => Payload}; +unmarshal_event(#{event_id := EventID, event_timestamp := Ts}, Payload, <<"jaeger">>) -> + #{ + timestamp => Ts, + fields => [ + #{ + key => <<"event.id">>, + type => <<"int64">>, + value => EventID + }, + #{ + key => <<"event.payload">>, + type => <<"string">>, + value => unicode:characters_to_binary(json:encode(Payload)) + } + ] + }. + +maybe_format(Data) when is_binary(Data) -> + case is_printable_string(Data) of + true -> + #{ + content_type => <<"text">>, + content => Data + }; + false -> + to_maps(term_to_object_content(Data)) + end; +maybe_format(Data) -> + #{ + content_type => <<"unknown">>, + content => format(Data) + }. + +format(Data) -> + unicode:characters_to_binary(io_lib:format("~p", [Data])). + +extract_trace_id(#{context := <<>>}) -> + null; +extract_trace_id(#{context := BinContext}) -> + try binary_to_term(BinContext) of + #{<<"otel">> := [TraceID | _]} -> + TraceID; + _ -> + null + catch + _:_ -> + null + end. + +extract_error(#{task_status := <<"error">>, response := {error, ReasonTerm}}) -> + #{content := Content} = maybe_format(ReasonTerm), + Content; +extract_error(_) -> + null. + +service_name(invoice) -> + <<"hellgate_invoice">>; +service_name(invoice_template) -> + <<"hellgate_invoice_template">>. + +trace_id(NS, ProcessID) -> + NsBin = erlang:atom_to_binary(NS), + HexList = [io_lib:format("~2.16.0b", [B]) || <> <= <>], + Hex = lists:flatten(HexList), + io:format(user, "HEX: ~p~n", [Hex]), + case length(Hex) of + Len when Len < 32 -> unicode:characters_to_binary(lists:duplicate(32 - Len, $0) ++ Hex); + Len when Len > 32 -> unicode:characters_to_binary(string:slice(Hex, 0, 32)); + _ -> unicode:characters_to_binary(Hex) + end. + +start_time(#{running := Ts}) -> + Ts; +start_time(_) -> + null. + +duration(#{running := Running, finished := Finished}) -> + Finished - Running; +duration(_) -> + null. + +error_tag(#{task_status := <<"error">>, response := {error, ReasonTerm}}) -> + #{content := Content} = maybe_format(ReasonTerm), + [ + #{ + key => <<"task.error">>, + type => <<"string">>, + value => Content + } + ]; +error_tag(_) -> + []. + +-define(is_integer(T), (T == byte orelse T == i8 orelse T == i16 orelse T == i32 orelse T == i64)). +-define(is_number(T), (?is_integer(T) orelse T == double)). +-define(is_scalar(T), (?is_number(T) orelse T == string orelse element(1, T) == enum)). + +-spec term_to_object(term(), hg_proto_utils:thrift_type()) -> jsone:json_value(). +term_to_object(Term, Type) -> + term_to_object(Term, Type, []). + +term_to_object(Term, {list, Type}, Stack) when is_list(Term) -> + [term_to_object(T, Type, [N | Stack]) || {N, T} <- enumerate(0, Term)]; +term_to_object(Term, {set, Type}, Stack) -> + term_to_object(ordsets:to_list(Term), {list, Type}, Stack); +term_to_object(Term, {map, KType, VType}, Stack) when is_map(Term), ?is_scalar(KType) -> + maps:fold( + fun(K, V, A) -> + [{genlib:to_binary(K), term_to_object(V, VType, [value, V | Stack])} | A] + end, + [], + Term + ); +term_to_object(Term, {map, KType, VType}, Stack) when is_map(Term) -> + maps:fold( + fun(K, V, A) -> + [ + [ + {<<"key">>, term_to_object(K, KType, [key, K | Stack])}, + {<<"value">>, term_to_object(V, VType, [value, V | Stack])} + ] + | A + ] + end, + [], + Term + ); +term_to_object(Term, {struct, union, {Mod, Name}}, Stack) when is_atom(Mod), is_atom(Name) -> + {struct, _, StructDef} = Mod:struct_info(Name), + union_to_object(Term, StructDef, Stack); +term_to_object(Term, {struct, _, {Mod, Name}}, Stack) when is_atom(Mod), is_atom(Name), is_tuple(Term) -> + {struct, _, StructDef} = Mod:struct_info(Name), + struct_to_object(Term, StructDef, Stack); +term_to_object(Term, {struct, struct, List}, Stack) when is_tuple(Term), is_list(List) -> + Data = lists:zip(List, tuple_to_list(Term)), + [{atom_to_binary(Name), term_to_object(V, Type, Stack)} || {{_Pos, _, Type, Name, _}, V} <- Data]; +term_to_object(Term, {enum, _}, _Stack) when is_atom(Term) -> + Term; +term_to_object(Term, Type, _Stack) when is_integer(Term), ?is_integer(Type) -> + Term; +term_to_object(Term, double, _Stack) when is_number(Term) -> + float(Term); +term_to_object(Term, string, _Stack) when is_binary(Term) -> + case is_printable_string(Term) of + true -> + Term; + false -> + term_to_object_content(Term) + end; +term_to_object(Term, bool, _Stack) when is_boolean(Term) -> + Term; +term_to_object(Term, Type, _Stack) -> + erlang:error({badarg, Term, Type}). + +union_to_object({Fn, Term}, StructDef, Stack) -> + {_N, _Req, Type, Fn, _Def} = lists:keyfind(Fn, 4, StructDef), + [{Fn, term_to_object(Term, Type, [Fn | Stack])}]. + +struct_to_object(Struct, StructDef, Stack) -> + [_ | Fields] = tuple_to_list(Struct), + lists:foldr( + fun + ({undefined, _}, A) -> + A; + ({Term, {_N, _Req, Type, Fn, _Def}}, A) -> + [{Fn, term_to_object(Term, Type, [Fn | Stack])} | A] + end, + [], + lists:zip(Fields, StructDef) + ). + +term_to_object_content(Term) -> + term_to_object_content(<<"base64">>, base64:encode(Term)). + +term_to_object_content(CType, Term) -> + [ + {<<"content_type">>, CType}, + {<<"content">>, Term} + ]. + +enumerate(_, []) -> + []; +enumerate(N, [H | T]) -> + [{N, H} | enumerate(N + 1, T)]. + +is_printable_string(V) -> + try unicode:characters_to_binary(V) of + B when is_binary(B) -> + true; + _ -> + false + catch + _:_ -> + false + end. + +to_maps(Data) -> + to_maps(Data, #{}). + +to_maps([], Acc) -> + Acc; +to_maps([{K, [{_, _} | _] = V} | Rest], Acc) -> + to_maps(Rest, Acc#{K => to_maps(V)}); +to_maps([{K, V} | Rest], Acc) when is_list(V) -> + to_maps(Rest, Acc#{K => lists:map(fun(E) -> to_maps(E) end, V)}); +to_maps([{K, V} | Rest], Acc) -> + to_maps(Rest, Acc#{K => V}). diff --git a/compose.tracing.yaml b/compose.tracing.yaml index 24e0bbbf..5c327a0c 100644 --- a/compose.tracing.yaml +++ b/compose.tracing.yaml @@ -24,6 +24,8 @@ services: depends_on: jaeger: condition: service_healthy + grafana: + condition: service_healthy jaeger: image: jaegertracing/all-in-one:1.47 @@ -39,4 +41,21 @@ services: - 4318:4318 # OTLP http receiver - 5778:5778 - 14250:14250 + - 14268:14268 - 16686:16686 + + grafana: + image: grafana/grafana-enterprise + container_name: grafana + restart: unless-stopped + environment: + - GF_LOG_LEVEL=warning + healthcheck: + test: "exit 0" + ports: + - '3000:3000' + volumes: + - 'grafana_storage:/var/lib/grafana' + +volumes: + grafana_storage: {} \ No newline at end of file diff --git a/elvis.config b/elvis.config index 49988ab4..cd617cb9 100644 --- a/elvis.config +++ b/elvis.config @@ -26,7 +26,7 @@ ] }}, {elvis_style, no_if_expression}, - {elvis_style, invalid_dynamic_call, #{ignore => [hg_proto_utils]}}, + {elvis_style, invalid_dynamic_call, #{ignore => [hg_proto_utils, hg_progressor_handler]}}, {elvis_style, used_ignored_variable}, {elvis_style, no_behavior_info}, {elvis_style, macro_names, #{regex => "^([a-zA-Z][a-zA-Z_0-9]+)$"}}, diff --git a/process_trace_internal.json b/process_trace_internal.json new file mode 100644 index 00000000..1074e2b8 --- /dev/null +++ b/process_trace_internal.json @@ -0,0 +1,1024 @@ +[ + { + "error": null, + "args": { + "content": { + "call": { + "function": "Create", + "service": "Invoicing" + }, + "params": { + "id": "2EO5GAM66Qi", + "status": { + "unpaid": [] + }, + "context": { + "data": "some_merchant_specific_data", + "type": "application/octet-stream" + }, + "details": { + "product": "rubberduck" + }, + "created_at": "2026-02-25T12:49:54.848195Z", + "due": "2026-02-25T12:50:04Z", + "cost": { + "currency": { + "symbolic_code": "RUB" + }, + "amount": 42000 + }, + "party_ref": { + "id": "2EO5G8vXFqa" + }, + "domain_revision": 23, + "shop_ref": { + "id": "2EO5G8vXFqb" + } + } + }, + "content_type": "thrift_call" + }, + "running": 1772023794866724, + "finished": 1772023794969412, + "events": [ + { + "event_id": 1, + "event_timestamp": 1772023794, + "event_payload": { + "invoice_changes": [ + { + "invoice_created": { + "invoice": { + "id": "2EO5GAM66Qi", + "status": { + "unpaid": [] + }, + "context": { + "data": "some_merchant_specific_data", + "type": "application/octet-stream" + }, + "details": { + "product": "rubberduck" + }, + "created_at": "2026-02-25T12:49:54.848195Z", + "due": "2026-02-25T12:50:04Z", + "cost": { + "currency": { + "symbolic_code": "RUB" + }, + "amount": 42000 + }, + "party_ref": { + "id": "2EO5G8vXFqa" + }, + "domain_revision": 23, + "shop_ref": { + "id": "2EO5G8vXFqb" + } + } + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "a3e5e913899103ab91084bde6132c29d", + "task_type": "init", + "task_id": 46, + "task_status": "finished", + "scheduled": 1772023794866724, + "task_metadata": { + "range": {} + }, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": { + "content": { + "call": { + "function": "StartPayment", + "service": "Invoicing" + }, + "params": { + "id": "2EO5GAM66Qi", + "params": { + "context": { + "data": { + "content": "g2gEdwN5b3ViAAACg2sAA25vdGwAAAACbQAAAAd3ZWxjb21ldwRoZXJlag==", + "content_type": "base64" + }, + "type": "application/x-erlang-binary" + }, + "payer": { + "payment_resource": { + "resource": { + "client_info": [], + "payment_tool": { + "bank_card": { + "bin": "424242", + "token": "no_preauth", + "payment_system": { + "id": "visa-ref" + }, + "last_digits": "4242" + } + }, + "payment_session_id": "SESSION42" + }, + "contact_info": [] + } + }, + "payer_session_info": { + "redirect_url": "https://redirectly.io/merchant" + }, + "flow": { + "instant": [] + } + } + } + }, + "content_type": "thrift_call" + }, + "running": 1772023795035843, + "finished": 1772023795100601, + "events": [ + { + "event_id": 2, + "event_timestamp": 1772023795, + "event_payload": { + "invoice_changes": [ + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_started": { + "payment": { + "id": "1", + "status": { + "pending": [] + }, + "context": { + "data": { + "content": "g2gEdwN5b3ViAAACg2sAA25vdGwAAAACbQAAAAd3ZWxjb21ldwRoZXJlag==", + "content_type": "base64" + }, + "type": "application/x-erlang-binary" + }, + "created_at": "2026-02-25T12:49:55.057164Z", + "cost": { + "currency": { + "symbolic_code": "RUB" + }, + "amount": 42000 + }, + "payer": { + "payment_resource": { + "resource": { + "client_info": [], + "payment_tool": { + "bank_card": { + "bin": "424242", + "token": "no_preauth", + "payment_system": { + "id": "visa-ref" + }, + "last_digits": "4242" + } + }, + "payment_session_id": "SESSION42" + }, + "contact_info": [] + } + }, + "payer_session_info": { + "redirect_url": "https://redirectly.io/merchant" + }, + "flow": { + "instant": [] + }, + "make_recurrent": false, + "party_ref": { + "id": "2EO5G8vXFqa" + }, + "domain_revision": 23, + "shop_ref": { + "id": "2EO5G8vXFqb" + }, + "registration_origin": { + "merchant": [] + } + } + } + }, + "occurred_at": "2026-02-25T12:49:55.057164Z" + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "4bb347c55483acdffaeb776dd837c186", + "task_type": "call", + "task_id": 48, + "task_status": "finished", + "scheduled": 1772023795035843, + "task_metadata": { + "range": { + "direction": "forward" + } + }, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": "", + "running": 1772023795109588, + "finished": 1772023795125388, + "events": [ + { + "event_id": 3, + "event_timestamp": 1772023795, + "event_payload": { + "invoice_changes": [ + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_shop_limit_initiated": [] + }, + "occurred_at": "2026-02-25T12:49:55.114294Z" + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "4bb347c55483acdffaeb776dd837c186", + "task_type": "timeout", + "task_id": 49, + "task_status": "finished", + "scheduled": 1772023795000000, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": "", + "running": 1772023795136323, + "finished": 1772023795138944, + "events": [ + { + "event_id": 4, + "event_timestamp": 1772023795, + "event_payload": { + "invoice_changes": [ + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_shop_limit_applied": [] + }, + "occurred_at": "2026-02-25T12:49:55.138853Z" + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "4bb347c55483acdffaeb776dd837c186", + "task_type": "timeout", + "task_id": 50, + "task_status": "finished", + "scheduled": 1772023795000000, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": "", + "running": 1772023795148721, + "finished": 1772023795197241, + "events": [ + { + "event_id": 5, + "event_timestamp": 1772023795, + "event_payload": { + "invoice_changes": [ + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_risk_score_changed": { + "risk_score": "trusted" + } + }, + "occurred_at": "2026-02-25T12:49:55.151307Z" + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "4bb347c55483acdffaeb776dd837c186", + "task_type": "timeout", + "task_id": 51, + "task_status": "finished", + "scheduled": 1772023795000000, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": "", + "running": 1772023795205311, + "finished": 1772023795384857, + "events": [ + { + "event_id": 6, + "event_timestamp": 1772023795, + "event_payload": { + "invoice_changes": [ + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_route_changed": { + "candidates": [ + { + "terminal": { + "id": 1 + }, + "provider": { + "id": 1 + } + }, + { + "terminal": { + "id": 2 + }, + "provider": { + "id": 1 + } + } + ], + "route": { + "terminal": { + "id": 2 + }, + "provider": { + "id": 1 + } + }, + "scores": [ + { + "key": { + "terminal": { + "id": 2 + }, + "provider": { + "id": 1 + } + }, + "value": { + "availability_condition": 1, + "conversion_condition": 1, + "terminal_priority_rating": 1000, + "route_pin": 0, + "random_condition": 0, + "availability": 1.0, + "conversion": 1.0, + "blacklist_condition": 0 + } + }, + { + "key": { + "terminal": { + "id": 1 + }, + "provider": { + "id": 1 + } + }, + "value": { + "availability_condition": 1, + "conversion_condition": 1, + "terminal_priority_rating": 1000, + "route_pin": 0, + "random_condition": 0, + "availability": 1.0, + "conversion": 1.0, + "blacklist_condition": 0 + } + } + ], + "limits": [ + { + "key": { + "terminal": { + "id": 2 + }, + "provider": { + "id": 1 + } + }, + "value": [] + }, + { + "key": { + "terminal": { + "id": 1 + }, + "provider": { + "id": 1 + } + }, + "value": [] + } + ], + "decision": [] + } + }, + "occurred_at": "2026-02-25T12:49:55.207872Z" + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "4bb347c55483acdffaeb776dd837c186", + "task_type": "timeout", + "task_id": 52, + "task_status": "finished", + "scheduled": 1772023795000000, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": "", + "running": 1772023795400399, + "finished": 1772023795501233, + "events": [ + { + "event_id": 7, + "event_timestamp": 1772023795, + "event_payload": { + "invoice_changes": [ + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_cash_flow_changed": { + "cash_flow": [ + { + "source": { + "account_id": 27, + "account_type": { + "merchant": "settlement" + }, + "transaction_account": { + "merchant": { + "owner": { + "party_ref": { + "id": "2EO5G8vXFqa" + }, + "shop_ref": { + "id": "2EO5G8vXFqb" + } + }, + "type": "settlement" + } + } + }, + "destination": { + "account_id": 22, + "account_type": { + "system": "settlement" + }, + "transaction_account": { + "system": { + "type": "settlement" + } + } + }, + "volume": { + "currency": { + "symbolic_code": "RUB" + }, + "amount": 1890 + } + }, + { + "source": { + "account_id": 26, + "account_type": { + "provider": "settlement" + }, + "transaction_account": { + "provider": { + "owner": { + "provider_ref": { + "id": 1 + }, + "terminal_ref": { + "id": 2 + } + }, + "type": "settlement" + } + } + }, + "destination": { + "account_id": 27, + "account_type": { + "merchant": "settlement" + }, + "transaction_account": { + "merchant": { + "owner": { + "party_ref": { + "id": "2EO5G8vXFqa" + }, + "shop_ref": { + "id": "2EO5G8vXFqb" + } + }, + "type": "settlement" + } + } + }, + "volume": { + "currency": { + "symbolic_code": "RUB" + }, + "amount": 42000 + } + }, + { + "source": { + "account_id": 22, + "account_type": { + "system": "settlement" + }, + "transaction_account": { + "system": { + "type": "settlement" + } + } + }, + "destination": { + "account_id": 26, + "account_type": { + "provider": "settlement" + }, + "transaction_account": { + "provider": { + "owner": { + "provider_ref": { + "id": 1 + }, + "terminal_ref": { + "id": 2 + } + }, + "type": "settlement" + } + } + }, + "volume": { + "currency": { + "symbolic_code": "RUB" + }, + "amount": 756 + } + } + ] + } + }, + "occurred_at": "2026-02-25T12:49:55.403233Z" + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "4bb347c55483acdffaeb776dd837c186", + "task_type": "timeout", + "task_id": 53, + "task_status": "finished", + "scheduled": 1772023795000000, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": "", + "running": 1772023795513803, + "finished": 1772023795522005, + "events": [ + { + "event_id": 8, + "event_timestamp": 1772023795, + "event_payload": { + "invoice_changes": [ + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_session_change": { + "target": { + "processed": [] + }, + "payload": { + "session_started": [] + } + } + }, + "occurred_at": "2026-02-25T12:49:55.516622Z" + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "4bb347c55483acdffaeb776dd837c186", + "task_type": "timeout", + "task_id": 54, + "task_status": "finished", + "scheduled": 1772023795000000, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": "", + "running": 1772023795534775, + "finished": 1772023795596815, + "events": [ + { + "event_id": 9, + "event_timestamp": 1772023795, + "event_payload": { + "invoice_changes": [ + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_session_change": { + "target": { + "processed": [] + }, + "payload": { + "session_proxy_state_changed": { + "proxy_state": "sleeping" + } + } + } + }, + "occurred_at": "2026-02-25T12:49:55.539912Z" + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "4bb347c55483acdffaeb776dd837c186", + "task_type": "timeout", + "task_id": 55, + "task_status": "finished", + "scheduled": 1772023795000000, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": "", + "running": 1772023795610040, + "finished": 1772023795636443, + "events": [ + { + "event_id": 10, + "event_timestamp": 1772023795, + "event_payload": { + "invoice_changes": [ + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_session_change": { + "target": { + "processed": [] + }, + "payload": { + "session_transaction_bound": { + "trx": { + "extra": { + "payment.payer_session_info.redirect_url": "https://redirectly.io/merchant" + }, + "id": "1.brovider", + "additional_info": { + "rrn": "rrn", + "approval_code": "code" + } + } + } + } + } + }, + "occurred_at": "2026-02-25T12:49:55.613632Z" + } + }, + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_session_change": { + "target": { + "processed": [] + }, + "payload": { + "session_finished": { + "result": { + "succeeded": [] + } + } + } + } + }, + "occurred_at": "2026-02-25T12:49:55.613632Z" + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "4bb347c55483acdffaeb776dd837c186", + "task_type": "timeout", + "task_id": 56, + "task_status": "finished", + "scheduled": 1772023795000000, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": "", + "running": 1772023795650703, + "finished": 1772023795654083, + "events": [ + { + "event_id": 11, + "event_timestamp": 1772023795, + "event_payload": { + "invoice_changes": [ + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_status_changed": { + "status": { + "processed": [] + } + } + }, + "occurred_at": "2026-02-25T12:49:55.653984Z" + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "4bb347c55483acdffaeb776dd837c186", + "task_type": "timeout", + "task_id": 57, + "task_status": "finished", + "scheduled": 1772023795000000, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": "", + "running": 1772023795668456, + "finished": 1772023795672216, + "events": [ + { + "event_id": 12, + "event_timestamp": 1772023795, + "event_payload": { + "invoice_changes": [ + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_capture_started": { + "data": { + "reason": "Timeout", + "cash": { + "currency": { + "symbolic_code": "RUB" + }, + "amount": 42000 + } + } + } + }, + "occurred_at": "2026-02-25T12:49:55.672090Z" + } + }, + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_session_change": { + "target": { + "captured": { + "reason": "Timeout", + "cost": { + "currency": { + "symbolic_code": "RUB" + }, + "amount": 42000 + } + } + }, + "payload": { + "session_started": [] + } + } + }, + "occurred_at": "2026-02-25T12:49:55.672090Z" + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "4bb347c55483acdffaeb776dd837c186", + "task_type": "timeout", + "task_id": 58, + "task_status": "finished", + "scheduled": 1772023795000000, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": "", + "running": 1772023795684274, + "finished": 1772023795718523, + "events": [ + { + "event_id": 13, + "event_timestamp": 1772023795, + "event_payload": { + "invoice_changes": [ + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_session_change": { + "target": { + "captured": { + "reason": "Timeout", + "cost": { + "currency": { + "symbolic_code": "RUB" + }, + "amount": 42000 + } + } + }, + "payload": { + "session_finished": { + "result": { + "succeeded": [] + } + } + } + } + }, + "occurred_at": "2026-02-25T12:49:55.689069Z" + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "4bb347c55483acdffaeb776dd837c186", + "task_type": "timeout", + "task_id": 59, + "task_status": "finished", + "scheduled": 1772023795000000, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": "", + "running": 1772023795730487, + "finished": 1772023795767611, + "events": [ + { + "event_id": 14, + "event_timestamp": 1772023795, + "event_payload": { + "invoice_changes": [ + { + "invoice_payment_change": { + "id": "1", + "payload": { + "invoice_payment_status_changed": { + "status": { + "captured": { + "reason": "Timeout", + "cost": { + "currency": { + "symbolic_code": "RUB" + }, + "amount": 42000 + } + } + } + } + }, + "occurred_at": "2026-02-25T12:49:55.733874Z" + } + }, + { + "invoice_status_changed": { + "status": { + "paid": [] + } + } + } + ] + }, + "event_metadata": { + "format_version": 1 + } + } + ], + "otel_span_id": "4bb347c55483acdffaeb776dd837c186", + "task_type": "timeout", + "task_id": 60, + "task_status": "finished", + "scheduled": 1772023795000000, + "retry_interval": 0, + "retry_attempts": 0 + }, + { + "error": null, + "args": "", + "events": [], + "otel_span_id": "a3e5e913899103ab91084bde6132c29d", + "task_type": "timeout", + "task_id": 47, + "task_status": "cancelled", + "scheduled": 1772023804000000, + "retry_interval": 0, + "retry_attempts": 0 + } +] diff --git a/process_trace_jaeger.json b/process_trace_jaeger.json new file mode 100644 index 00000000..a0354220 --- /dev/null +++ b/process_trace_jaeger.json @@ -0,0 +1,704 @@ +{ + "data": [ + { + "processes": { + "2EO5iMiMauG": { + "service_name": "hellgate_invoice", + "tags": [] + } + }, + "spans": [ + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 97096, + "startTime": 1772024176768885, + "span_id": "61", + "logs": [ + { + "timestamp": 1772024176, + "fields": [ + { + "type": "int64", + "value": 1, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_created\":{\"invoice\":{\"id\":\"2EO5iMiMauG\",\"status\":{\"unpaid\":[]},\"context\":{\"data\":\"some_merchant_specific_data\",\"type\":\"application/octet-stream\"},\"details\":{\"product\":\"rubberduck\"},\"created_at\":\"2026-02-25T12:56:16.740610Z\",\"due\":\"2026-02-25T12:56:26Z\",\"cost\":{\"currency\":{\"symbolic_code\":\"RUB\"},\"amount\":42000},\"party_ref\":{\"id\":\"2EO5iLKdjcm\"},\"domain_revision\":29,\"shop_ref\":{\"id\":\"2EO5iLKdjcn\"}}}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "{\"content\":{\"call\":{\"function\":\"Create\",\"service\":\"Invoicing\"},\"params\":{\"id\":\"2EO5iMiMauG\",\"status\":{\"unpaid\":[]},\"context\":{\"data\":\"some_merchant_specific_data\",\"type\":\"application/octet-stream\"},\"details\":{\"product\":\"rubberduck\"},\"created_at\":\"2026-02-25T12:56:16.740610Z\",\"due\":\"2026-02-25T12:56:26Z\",\"cost\":{\"currency\":{\"symbolic_code\":\"RUB\"},\"amount\":42000},\"party_ref\":{\"id\":\"2EO5iLKdjcm\"},\"domain_revision\":29,\"shop_ref\":{\"id\":\"2EO5iLKdjcn\"}}},\"content_type\":\"thrift_call\"}", + "key": "task.input" + } + ], + "operationName": "init", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 45117, + "startTime": 1772024176922951, + "span_id": "63", + "logs": [ + { + "timestamp": 1772024176, + "fields": [ + { + "type": "int64", + "value": 2, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_started\":{\"payment\":{\"id\":\"1\",\"status\":{\"pending\":[]},\"context\":{\"data\":{\"content\":\"g2gEdwN5b3ViAAACg2sAA25vdGwAAAACbQAAAAd3ZWxjb21ldwRoZXJlag==\",\"content_type\":\"base64\"},\"type\":\"application/x-erlang-binary\"},\"created_at\":\"2026-02-25T12:56:16.938738Z\",\"cost\":{\"currency\":{\"symbolic_code\":\"RUB\"},\"amount\":42000},\"payer\":{\"payment_resource\":{\"resource\":{\"client_info\":[],\"payment_tool\":{\"bank_card\":{\"bin\":\"424242\",\"token\":\"no_preauth\",\"payment_system\":{\"id\":\"visa-ref\"},\"last_digits\":\"4242\"}},\"payment_session_id\":\"SESSION42\"},\"contact_info\":[]}},\"payer_session_info\":{\"redirect_url\":\"https://redirectly.io/merchant\"},\"flow\":{\"instant\":[]},\"make_recurrent\":false,\"party_ref\":{\"id\":\"2EO5iLKdjcm\"},\"domain_revision\":29,\"shop_ref\":{\"id\":\"2EO5iLKdjcn\"},\"registration_origin\":{\"merchant\":[]}}}},\"occurred_at\":\"2026-02-25T12:56:16.938738Z\"}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "{\"content\":{\"call\":{\"function\":\"StartPayment\",\"service\":\"Invoicing\"},\"params\":{\"id\":\"2EO5iMiMauG\",\"params\":{\"context\":{\"data\":{\"content\":\"g2gEdwN5b3ViAAACg2sAA25vdGwAAAACbQAAAAd3ZWxjb21ldwRoZXJlag==\",\"content_type\":\"base64\"},\"type\":\"application/x-erlang-binary\"},\"payer\":{\"payment_resource\":{\"resource\":{\"client_info\":[],\"payment_tool\":{\"bank_card\":{\"bin\":\"424242\",\"token\":\"no_preauth\",\"payment_system\":{\"id\":\"visa-ref\"},\"last_digits\":\"4242\"}},\"payment_session_id\":\"SESSION42\"},\"contact_info\":[]}},\"payer_session_info\":{\"redirect_url\":\"https://redirectly.io/merchant\"},\"flow\":{\"instant\":[]}}}},\"content_type\":\"thrift_call\"}", + "key": "task.input" + } + ], + "operationName": "call", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 12753, + "startTime": 1772024176975648, + "span_id": "64", + "logs": [ + { + "timestamp": 1772024176, + "fields": [ + { + "type": "int64", + "value": 3, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_shop_limit_initiated\":[]},\"occurred_at\":\"2026-02-25T12:56:16.979693Z\"}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "\"\"", + "key": "task.input" + } + ], + "operationName": "timeout", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 2438, + "startTime": 1772024176998706, + "span_id": "65", + "logs": [ + { + "timestamp": 1772024177, + "fields": [ + { + "type": "int64", + "value": 4, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_shop_limit_applied\":[]},\"occurred_at\":\"2026-02-25T12:56:17.001075Z\"}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "\"\"", + "key": "task.input" + } + ], + "operationName": "timeout", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 44970, + "startTime": 1772024177008027, + "span_id": "66", + "logs": [ + { + "timestamp": 1772024177, + "fields": [ + { + "type": "int64", + "value": 5, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_risk_score_changed\":{\"risk_score\":\"trusted\"}},\"occurred_at\":\"2026-02-25T12:56:17.010297Z\"}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "\"\"", + "key": "task.input" + } + ], + "operationName": "timeout", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 122165, + "startTime": 1772024177061407, + "span_id": "67", + "logs": [ + { + "timestamp": 1772024177, + "fields": [ + { + "type": "int64", + "value": 6, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_route_changed\":{\"candidates\":[{\"terminal\":{\"id\":1},\"provider\":{\"id\":1}},{\"terminal\":{\"id\":2},\"provider\":{\"id\":1}}],\"route\":{\"terminal\":{\"id\":2},\"provider\":{\"id\":1}},\"scores\":[{\"key\":{\"terminal\":{\"id\":2},\"provider\":{\"id\":1}},\"value\":{\"availability_condition\":1,\"conversion_condition\":1,\"terminal_priority_rating\":1000,\"route_pin\":0,\"random_condition\":0,\"availability\":1.0,\"conversion\":1.0,\"blacklist_condition\":0}},{\"key\":{\"terminal\":{\"id\":1},\"provider\":{\"id\":1}},\"value\":{\"availability_condition\":1,\"conversion_condition\":1,\"terminal_priority_rating\":1000,\"route_pin\":0,\"random_condition\":0,\"availability\":1.0,\"conversion\":1.0,\"blacklist_condition\":0}}],\"limits\":[{\"key\":{\"terminal\":{\"id\":2},\"provider\":{\"id\":1}},\"value\":[]},{\"key\":{\"terminal\":{\"id\":1},\"provider\":{\"id\":1}},\"value\":[]}],\"decision\":[]}},\"occurred_at\":\"2026-02-25T12:56:17.064254Z\"}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "\"\"", + "key": "task.input" + } + ], + "operationName": "timeout", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 68078, + "startTime": 1772024177191694, + "span_id": "68", + "logs": [ + { + "timestamp": 1772024177, + "fields": [ + { + "type": "int64", + "value": 7, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_cash_flow_changed\":{\"cash_flow\":[{\"source\":{\"account_id\":34,\"account_type\":{\"merchant\":\"settlement\"},\"transaction_account\":{\"merchant\":{\"owner\":{\"party_ref\":{\"id\":\"2EO5iLKdjcm\"},\"shop_ref\":{\"id\":\"2EO5iLKdjcn\"}},\"type\":\"settlement\"}}},\"destination\":{\"account_id\":29,\"account_type\":{\"system\":\"settlement\"},\"transaction_account\":{\"system\":{\"type\":\"settlement\"}}},\"volume\":{\"currency\":{\"symbolic_code\":\"RUB\"},\"amount\":1890}},{\"source\":{\"account_id\":33,\"account_type\":{\"provider\":\"settlement\"},\"transaction_account\":{\"provider\":{\"owner\":{\"provider_ref\":{\"id\":1},\"terminal_ref\":{\"id\":2}},\"type\":\"settlement\"}}},\"destination\":{\"account_id\":34,\"account_type\":{\"merchant\":\"settlement\"},\"transaction_account\":{\"merchant\":{\"owner\":{\"party_ref\":{\"id\":\"2EO5iLKdjcm\"},\"shop_ref\":{\"id\":\"2EO5iLKdjcn\"}},\"type\":\"settlement\"}}},\"volume\":{\"currency\":{\"symbolic_code\":\"RUB\"},\"amount\":42000}},{\"source\":{\"account_id\":29,\"account_type\":{\"system\":\"settlement\"},\"transaction_account\":{\"system\":{\"type\":\"settlement\"}}},\"destination\":{\"account_id\":33,\"account_type\":{\"provider\":\"settlement\"},\"transaction_account\":{\"provider\":{\"owner\":{\"provider_ref\":{\"id\":1},\"terminal_ref\":{\"id\":2}},\"type\":\"settlement\"}}},\"volume\":{\"currency\":{\"symbolic_code\":\"RUB\"},\"amount\":756}}]}},\"occurred_at\":\"2026-02-25T12:56:17.194473Z\"}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "\"\"", + "key": "task.input" + } + ], + "operationName": "timeout", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 6716, + "startTime": 1772024177267778, + "span_id": "69", + "logs": [ + { + "timestamp": 1772024177, + "fields": [ + { + "type": "int64", + "value": 8, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_session_change\":{\"target\":{\"processed\":[]},\"payload\":{\"session_started\":[]}}},\"occurred_at\":\"2026-02-25T12:56:17.270205Z\"}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "\"\"", + "key": "task.input" + } + ], + "operationName": "timeout", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 40897, + "startTime": 1772024177282855, + "span_id": "70", + "logs": [ + { + "timestamp": 1772024177, + "fields": [ + { + "type": "int64", + "value": 9, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_session_change\":{\"target\":{\"processed\":[]},\"payload\":{\"session_proxy_state_changed\":{\"proxy_state\":\"sleeping\"}}}},\"occurred_at\":\"2026-02-25T12:56:17.286604Z\"}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "\"\"", + "key": "task.input" + } + ], + "operationName": "timeout", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 21640, + "startTime": 1772024177331632, + "span_id": "71", + "logs": [ + { + "timestamp": 1772024177, + "fields": [ + { + "type": "int64", + "value": 10, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_session_change\":{\"target\":{\"processed\":[]},\"payload\":{\"session_transaction_bound\":{\"trx\":{\"extra\":{\"payment.payer_session_info.redirect_url\":\"https://redirectly.io/merchant\"},\"id\":\"1.brovider\",\"additional_info\":{\"rrn\":\"rrn\",\"approval_code\":\"code\"}}}}}},\"occurred_at\":\"2026-02-25T12:56:17.334169Z\"}},{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_session_change\":{\"target\":{\"processed\":[]},\"payload\":{\"session_finished\":{\"result\":{\"succeeded\":[]}}}}},\"occurred_at\":\"2026-02-25T12:56:17.334169Z\"}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "\"\"", + "key": "task.input" + } + ], + "operationName": "timeout", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 2916, + "startTime": 1772024177361987, + "span_id": "72", + "logs": [ + { + "timestamp": 1772024177, + "fields": [ + { + "type": "int64", + "value": 11, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_status_changed\":{\"status\":{\"processed\":[]}}},\"occurred_at\":\"2026-02-25T12:56:17.364822Z\"}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "\"\"", + "key": "task.input" + } + ], + "operationName": "timeout", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 3672, + "startTime": 1772024177372991, + "span_id": "73", + "logs": [ + { + "timestamp": 1772024177, + "fields": [ + { + "type": "int64", + "value": 12, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_capture_started\":{\"data\":{\"reason\":\"Timeout\",\"cash\":{\"currency\":{\"symbolic_code\":\"RUB\"},\"amount\":42000}}}},\"occurred_at\":\"2026-02-25T12:56:17.376537Z\"}},{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_session_change\":{\"target\":{\"captured\":{\"reason\":\"Timeout\",\"cost\":{\"currency\":{\"symbolic_code\":\"RUB\"},\"amount\":42000}}},\"payload\":{\"session_started\":[]}}},\"occurred_at\":\"2026-02-25T12:56:17.376537Z\"}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "\"\"", + "key": "task.input" + } + ], + "operationName": "timeout", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 30739, + "startTime": 1772024177387714, + "span_id": "74", + "logs": [ + { + "timestamp": 1772024177, + "fields": [ + { + "type": "int64", + "value": 13, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_session_change\":{\"target\":{\"captured\":{\"reason\":\"Timeout\",\"cost\":{\"currency\":{\"symbolic_code\":\"RUB\"},\"amount\":42000}}},\"payload\":{\"session_finished\":{\"result\":{\"succeeded\":[]}}}}},\"occurred_at\":\"2026-02-25T12:56:17.392101Z\"}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "\"\"", + "key": "task.input" + } + ], + "operationName": "timeout", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": 31651, + "startTime": 1772024177426858, + "span_id": "75", + "logs": [ + { + "timestamp": 1772024177, + "fields": [ + { + "type": "int64", + "value": 14, + "key": "event.id" + }, + { + "type": "string", + "value": "{\"invoice_changes\":[{\"invoice_payment_change\":{\"id\":\"1\",\"payload\":{\"invoice_payment_status_changed\":{\"status\":{\"captured\":{\"reason\":\"Timeout\",\"cost\":{\"currency\":{\"symbolic_code\":\"RUB\"},\"amount\":42000}}}}},\"occurred_at\":\"2026-02-25T12:56:17.430665Z\"}},{\"invoice_status_changed\":{\"status\":{\"paid\":[]}}}]}", + "key": "event.payload" + } + ] + } + ], + "tags": [ + { + "type": "string", + "value": "finished", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "\"\"", + "key": "task.input" + } + ], + "operationName": "timeout", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + }, + { + "process": { + "service_name": "hellgate_invoice", + "tags": [] + }, + "warnings": [], + "duration": null, + "startTime": null, + "span_id": "62", + "logs": [], + "tags": [ + { + "type": "string", + "value": "cancelled", + "key": "task.status" + }, + { + "type": "int64", + "value": 0, + "key": "task.retries" + }, + { + "type": "string", + "value": "\"\"", + "key": "task.input" + } + ], + "operationName": "timeout", + "processID": "2EO5iMiMauG", + "traceId": "696e766f69636532454f35694d694d61" + } + ], + "traceID": "696e766f69636532454f35694d694d61" + } + ] +} diff --git a/rebar.config b/rebar.config index e54b9e06..2dafc82c 100644 --- a/rebar.config +++ b/rebar.config @@ -42,7 +42,7 @@ {fault_detector_proto, {git, "https://github.com/valitydev/fault-detector-proto.git", {branch, "master"}}}, {limiter_proto, {git, "https://github.com/valitydev/limiter-proto.git", {tag, "v2.1.0"}}}, {herd, {git, "https://github.com/wgnet/herd.git", {tag, "1.3.4"}}}, - {progressor, {git, "https://github.com/valitydev/progressor.git", {tag, "v1.0.20"}}}, + {progressor, {git, "https://github.com/valitydev/progressor.git", {branch, "ft/process-tracing"}}}, {prometheus, "4.11.0"}, {prometheus_cowboy, "0.1.9"}, @@ -105,7 +105,7 @@ {deps, [ {meck, "0.9.2"} ]}, - {dialyzer, [{plt_extra_apps, [eunit, common_test, runtime_tools, damsel, meck]}]} + {dialyzer, [{plt_extra_apps, [eunit, common_test, runtime_tools, damsel, meck, jsone]}]} ]} ]}. diff --git a/rebar.lock b/rebar.lock index 11e04791..b1eccf56 100644 --- a/rebar.lock +++ b/rebar.lock @@ -100,7 +100,7 @@ 0}, {<<"progressor">>, {git,"https://github.com/valitydev/progressor.git", - {ref,"6033631d3e1eb9593acf7841d8a635146ff482e8"}}, + {ref,"99c356d6aa55943d3f402d0c0551f7a3a0ee3927"}}, 0}, {<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.11.0">>},0}, {<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.9">>},0},