TD-621: add logging for rejected routes (#32)

* TD-621: add logging for rejected routes

* TD-621: fix issue

---------

Co-authored-by: anatoliy.losev <losto@nix>
This commit is contained in:
ttt161 2023-06-06 12:58:40 +03:00 committed by GitHub
parent 6a6118caa5
commit 9150bc3545
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ rebar3.crashdump
/.idea/
*.beam
tags
*.iml
# make stuff
/.image.*

View File

@ -15,6 +15,12 @@
-spec reduce_payment_routing_ruleset(payment_routing_ruleset(), varset(), domain_revision()) ->
payment_routing_ruleset().
reduce_payment_routing_ruleset(RuleSet, VS, DomainRevision) ->
logger:log(
info,
"Routing start reduce ruleset with varset: ~p",
[VS],
logger:get_process_metadata()
),
RuleSet#domain_RoutingRuleset{
decisions = reduce_payment_routing_decisions(RuleSet#domain_RoutingRuleset.decisions, VS, DomainRevision)
}.
@ -31,6 +37,12 @@ reduce_payment_routing_delegates([D | Delegates], VS, Rev) ->
RuleSetRef = D#domain_RoutingDelegate.ruleset,
case pm_selector:reduce_predicate(Predicate, VS, Rev) of
?const(false) ->
logger:log(
info,
"Routing delegate rejected. Delegate: ~p~nPredicate: ~p",
[D, Predicate],
logger:get_process_metadata()
),
reduce_payment_routing_delegates(Delegates, VS, Rev);
?const(true) ->
#domain_RoutingRuleset{
@ -52,6 +64,12 @@ reduce_payment_routing_candidates(Candidates, VS, Rev) ->
Predicate = C#domain_RoutingCandidate.allowed,
case pm_selector:reduce_predicate(Predicate, VS, Rev) of
?const(false) ->
logger:log(
info,
"Routing candidate rejected. Candidate: ~p~nPredicate: ~p",
[C, Predicate],
logger:get_process_metadata()
),
AccIn;
?const(true) = ReducedPredicate ->
ReducedCandidate = C#domain_RoutingCandidate{