@@ -48,7 +48,6 @@ use rand::SeedableRng;
48
48
use router_env:: { instrument, tracing} ;
49
49
use rustc_hash:: FxHashMap ;
50
50
use storage_impl:: redis:: cache:: { CacheKey , CGRAPH_CACHE , ROUTING_CACHE } ;
51
- use utils:: perform_decision_euclid_routing;
52
51
53
52
#[ cfg( feature = "v2" ) ]
54
53
use crate :: core:: admin;
@@ -492,33 +491,24 @@ pub async fn perform_static_routing_v1(
492
491
. to_string ( ) ,
493
492
} ;
494
493
495
- let de_euclid_connectors = if state. conf . open_router . static_routing_enabled {
496
- let routing_events_wrapper = utils:: RoutingEventsWrapper :: new (
497
- state. tenant . tenant_id . clone ( ) ,
498
- state. request_id ,
499
- payment_id,
500
- business_profile. get_id ( ) . to_owned ( ) ,
501
- business_profile. merchant_id . to_owned ( ) ,
502
- "DecisionEngine: Euclid Static Routing" . to_string ( ) ,
503
- None ,
504
- true ,
505
- false ,
506
- ) ;
507
-
508
- perform_decision_euclid_routing (
494
+ // Decision of de-routing is stored
495
+ let de_evaluated_connector = if !state. conf . open_router . static_routing_enabled {
496
+ logger:: debug!( "decision_engine_euclid: decision_engine routing not enabled" ) ;
497
+ Vec :: default ( )
498
+ } else {
499
+ utils:: decision_engine_routing (
509
500
state,
510
501
backend_input. clone ( ) ,
511
- business_profile. get_id ( ) . get_string_repr ( ) . to_string ( ) ,
512
- routing_events_wrapper ,
502
+ business_profile,
503
+ payment_id ,
513
504
get_merchant_fallback_config ( ) . await ?,
514
505
)
515
506
. await
516
507
. map_err ( |e|
517
508
// errors are ignored as this is just for diff checking as of now (optional flow).
518
509
logger:: error!( decision_engine_euclid_evaluate_error=?e, "decision_engine_euclid: error in evaluation of rule" )
519
- ) . unwrap_or_default ( )
520
- } else {
521
- Vec :: default ( )
510
+ )
511
+ . unwrap_or_default ( )
522
512
} ;
523
513
524
514
let ( routable_connectors, routing_approach) = match cached_algorithm. as_ref ( ) {
@@ -538,8 +528,14 @@ pub async fn perform_static_routing_v1(
538
528
) ,
539
529
} ;
540
530
531
+ // Results are logged for diff(between legacy and decision_engine's euclid) and have parameters as:
532
+ // is_equal: verifies all output are matching in order,
533
+ // is_equal_length: matches length of both outputs (useful for verifying volume based routing
534
+ // results)
535
+ // de_response: response from the decision_engine's euclid
536
+ // hs_response: response from legacy_euclid
541
537
utils:: compare_and_log_result (
542
- de_euclid_connectors . clone ( ) ,
538
+ de_evaluated_connector . clone ( ) ,
543
539
routable_connectors. clone ( ) ,
544
540
"evaluate_routing" . to_string ( ) ,
545
541
) ;
@@ -549,7 +545,7 @@ pub async fn perform_static_routing_v1(
549
545
state,
550
546
business_profile,
551
547
routable_connectors,
552
- de_euclid_connectors ,
548
+ de_evaluated_connector ,
553
549
)
554
550
. await ,
555
551
routing_approach,
0 commit comments