Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

refactor(euclid): add logs for euclid routing (#8962)

Prajjwal Kumare09c39388084
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 371f625a82..2dfb3d25e3 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -8496,6 +8496,7 @@ where
.attach_printable("Invalid connector name received in 'routed_through'")?;
routing_data.routed_through = Some(connector_name.clone());
+ logger::debug!("euclid_routing: predetermined connector present in attempt");
return Ok(ConnectorCallType::PreDetermined(connector_data.into()));
}
@@ -8515,6 +8516,7 @@ where
.merchant_connector_id
.clone_from(&mandate_connector_details.merchant_connector_id);
+ logger::debug!("euclid_routing: predetermined mandate connector");
return Ok(ConnectorCallType::PreDetermined(connector_data.into()));
}
@@ -8599,6 +8601,8 @@ where
}
}
+ logger::debug!("euclid_routing: pre-routing connector present");
+
let first_pre_routing_connector_data_list = pre_routing_connector_data_list
.first()
.ok_or(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration)?;
@@ -8662,6 +8666,7 @@ where
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Invalid connector name received")?;
+ logger::debug!("euclid_routing: straight through connector present");
return decide_multiplex_connector_for_normal_or_recurring_payment(
&state,
payment_data,
@@ -8706,6 +8711,7 @@ where
.attach_printable("failed eligibility analysis and fallback")?;
}
+ logger::debug!("euclid_routing: single connector present in algorithm data");
let connector_data = connectors
.into_iter()
.map(|conn| {
@@ -8793,7 +8799,7 @@ where
Some(api::MandateTransactionType::RecurringMandateTransaction),
)
| (None, Some(_), None, Some(true), _) => {
- logger::debug!("performing routing for token-based MIT flow");
+ logger::debug!("euclid_routing: performing routing for token-based MIT flow");
let payment_method_info = payment_data
.get_payment_method_info()
@@ -8906,7 +8912,9 @@ where
.into(),
))
} else {
- logger::error!("no eligible connector found for the ppt_mandate payment");
+ logger::error!(
+ "euclid_routing: no eligible connector found for the ppt_mandate payment"
+ );
Err(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration.into())
}
}
@@ -8965,7 +8973,7 @@ where
})
.unwrap_or(false)
{
- logger::info!("using connector_mandate_id for MIT flow");
+ logger::info!("euclid_routing: using connector_mandate_id for MIT flow");
if let Some(merchant_connector_id) = connector_data.merchant_connector_id.as_ref() {
if let Some(mandate_reference_record) = connector_mandate_details.clone()
.get_required_value("connector_mandate_details")
diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs
index 19ddeb7f15..a06b6140da 100644
--- a/crates/router/src/core/payments/routing.rs
+++ b/crates/router/src/core/payments/routing.rs
@@ -441,6 +441,7 @@ pub async fn perform_static_routing_v1(
Vec<routing_types::RoutableConnectorChoice>,
Option<common_enums::RoutingApproach>,
)> {
+ logger::debug!("euclid_routing: performing routing for connector selection");
let get_merchant_fallback_config = || async {
#[cfg(feature = "v1")]
return routing::helpers::get_merchant_default_config(
@@ -459,6 +460,7 @@ pub async fn perform_static_routing_v1(
id
} else {
let fallback_config = get_merchant_fallback_config().await?;
+ logger::debug!("euclid_routing: active algorithm isn't present, default falling back");
return Ok((fallback_config, None));
};
let cached_algorithm = ensure_algorithm_cached_v1(
@@ -1038,6 +1040,7 @@ pub async fn perform_eligibility_analysis_with_fallback(
eligible_connectors: Option<Vec<api_enums::RoutableConnectors>>,
business_profile: &domain::Profile,
) -> RoutingResult<Vec<routing_types::RoutableConnectorChoice>> {
+ logger::debug!("euclid_routing: performing eligibility");
let mut final_selection = perform_eligibility_analysis(
state,
key_store,
@@ -1072,7 +1075,7 @@ pub async fn perform_eligibility_analysis_with_fallback(
.iter()
.map(|item| item.connector)
.collect::<Vec<_>>();
- logger::debug!(final_selected_connectors_for_routing=?final_selected_connectors, "List of final selected connectors for routing");
+ logger::debug!(final_selected_connectors_for_routing=?final_selected_connectors, "euclid_routing: List of final selected connectors for routing");
Ok(final_selection)
}