Skip to content

Commit 849ea0b

Browse files
fix: change logger level from info to debug for improved logging granularity (#189)
1 parent bd366f7 commit 849ea0b

File tree

4 files changed

+56
-41
lines changed

4 files changed

+56
-41
lines changed

src/decider/gatewaydecider/flow_new.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,13 @@ pub async fn run_decider_flow(
464464
// &currentGatewayScoreMap
465465
// ).await?;
466466

467-
logger::info!(
468-
action = "GATEWAY_PRIORITY_MAP",
469-
tag = "GATEWAY_PRIORITY_MAP",
470-
"{:?}",
471-
gatewayPriorityMap
472-
);
467+
if let Some(ref priority_map) = gatewayPriorityMap {
468+
logger::debug!(
469+
action = "GATEWAY_PRIORITY_MAP",
470+
tag = "GATEWAY_PRIORITY_MAP",
471+
gateway_priority_map = %priority_map
472+
);
473+
}
473474

474475
match decidedGateway {
475476
Some(decideGatewayOutput) => {

src/decider/gatewaydecider/flows.rs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ pub async fn run_decider_flow(
350350
.or(deciderParams.dpOrder.preferredGateway.clone());
351351
let gatewayMgaIdMap = get_gateway_to_mga_id_map_f(&allMgas, &functionalGateways);
352352

353-
logger::warn!(
353+
logger::debug!(
354354
action = "PreferredGateway",
355355
tag = "PreferredGateway",
356356
"Preferred gateway provided by merchant for {:?} = {:?}",
@@ -407,7 +407,7 @@ pub async fn run_decider_flow(
407407
gateways: vec![],
408408
});
409409

410-
logger::info!(
410+
logger::debug!(
411411
action = "PreferredGateway",
412412
tag = "PreferredGateway",
413413
"Preferred gateway {:?} functional/valid for merchant {:?} in txn {:?}",
@@ -460,18 +460,13 @@ pub async fn run_decider_flow(
460460
logger::info!(
461461
tag = "gatewayPriorityList",
462462
action = "gatewayPriorityList",
463-
"Gateway priority for merchant for {:?} = {:?}",
463+
"Gateway priority for merchant for {:?} = {:?}, gwPLogic : {:?}",
464464
&deciderParams.dpTxnDetail.txnId,
465-
gatewayPriorityList
465+
gatewayPriorityList,
466+
gwPLogic
466467
);
467468

468469
let (mut functionalGateways, updatedPriorityLogicOutput) = if gwPLogic.is_enforcement {
469-
logger::info!(
470-
tag = "gatewayPriorityList",
471-
action = "Enforcing Priority Logic",
472-
"Enforcing Priority Logic for {:?}",
473-
deciderParams.dpTxnDetail.txnId
474-
);
475470
let (res, priorityLogicOutput) = filter_functional_gateways_with_enforcement(
476471
&mut decider_flow,
477472
&functionalGateways,
@@ -617,7 +612,7 @@ pub async fn run_decider_flow(
617612
)
618613
.await;
619614

620-
logger::info!(
615+
logger::debug!(
621616
action = "Decided Gateway",
622617
tag = "Decided Gateway",
623618
"Gateway decided for {:?} = {:?}",
@@ -634,12 +629,13 @@ pub async fn run_decider_flow(
634629
// &currentGatewayScoreMap
635630
// ).await?;
636631

637-
logger::info!(
638-
action = "GATEWAY_PRIORITY_MAP",
639-
tag = "GATEWAY_PRIORITY_MAP",
640-
"{:?}",
641-
gatewayPriorityMap
642-
);
632+
if let Some(ref priority_map) = gatewayPriorityMap {
633+
logger::debug!(
634+
action = "GATEWAY_PRIORITY_MAP",
635+
tag = "GATEWAY_PRIORITY_MAP",
636+
gateway_priority_map = %priority_map
637+
);
638+
}
643639

644640
match decidedGateway {
645641
Some(decideGatewayOutput) => Ok(T::DecidedGateway {

src/decider/gatewaydecider/gw_scoring.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,9 +1280,20 @@ pub async fn get_global_gateway_score(
12801280
.iter()
12811281
.all(|x| x.score < score_threshold);
12821282
let filtered_merchants: Vec<GlobalScoreLog> = sorted_filtered_merchants
1283+
.clone()
12831284
.into_iter()
12841285
.map(|gs| mk_gsl(gs, score_threshold, max_count))
12851286
.collect();
1287+
logger::info!(
1288+
tag = "getGlobalGatewayScore",
1289+
action = "getGlobalGatewayScore",
1290+
"Filtered merchants for key {:?}: {:?} : {:?} : {:?} : {:?}",
1291+
redis_key,
1292+
global_gateway_score,
1293+
sorted_filtered_merchants,
1294+
should_penalize.clone(),
1295+
filtered_merchants.clone()
1296+
);
12861297
Some((
12871298
filtered_merchants,
12881299
if should_penalize {

src/decider/gatewaydecider/runner.rs

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,16 @@ pub async fn get_gateway_priority(
566566
let (script, priority_logic_tag) = get_script(macc.clone(), priority_logic_script_m).await;
567567
let result = evaluate_script(script.clone(), priority_logic_tag.clone()).await;
568568

569+
logger::info!(
570+
tag = "PRIORITY_LOGIC_EXECUTION_RESULT",
571+
"MerchantId: {:?} , Result: {:?}",
572+
macc.merchantId.clone(),
573+
result
574+
);
575+
569576
match result {
570577
EvaluationResult::PLResponse(gws, pl_data, logs, status) => {
571-
logger::info!(
578+
logger::debug!(
572579
tag = "PRIORITY_LOGIC_EXECUTION_",
573580
"MerchantId: {:?} , Gateways: {:?}, Logs: {:?}",
574581
macc.merchantId.clone(),
@@ -585,7 +592,7 @@ pub async fn get_gateway_priority(
585592
}
586593
}
587594
EvaluationResult::EvaluationError(priority_logic_data, err) => {
588-
logger::info!(
595+
logger::debug!(
589596
tag = "PRIORITY_LOGIC_EXECUTION_FAILURE",
590597
"MerchantId: {:?}, Error: {:?}",
591598
macc.merchantId,
@@ -598,7 +605,7 @@ pub async fn get_gateway_priority(
598605
match retry_result {
599606
EvaluationResult::PLResponse(retry_gws, retry_pl_data, logs, status) => {
600607
let tag = format!("PRIORITY_LOGIC_EXECUTION_RETRY_{}", status);
601-
logger::info!(
608+
logger::debug!(
602609
tag = %tag,
603610
"MerchantId: {:?} , Gateways: {:?}, Logs: {:?}",
604611
macc.merchantId,
@@ -615,7 +622,7 @@ pub async fn get_gateway_priority(
615622
}
616623
}
617624
EvaluationResult::EvaluationError(retry_pl_data, err) => {
618-
logger::info!(
625+
logger::debug!(
619626
tag = "PRIORITY_LOGIC_EXECUTION_RETRY_FAILURE",
620627
"MerchantId: {:?} , Error: {:?}",
621628
macc.merchantId,
@@ -664,7 +671,7 @@ pub async fn get_gateway_priority(
664671
None => default_gateway_priority_logic_output(),
665672
Some(t) => {
666673
if t.is_empty() {
667-
logger::info!(
674+
logger::debug!(
668675
tag = "gatewayPriority",
669676
"gatewayPriority for merchant: {:?} is empty.",
670677
macc.merchantId
@@ -676,15 +683,15 @@ pub async fn get_gateway_priority(
676683
.map(|s| s.trim().to_string())
677684
.filter(|s| !s.is_empty())
678685
.collect::<Vec<_>>();
679-
logger::info!(
686+
logger::debug!(
680687
tag = "gatewayPriority",
681688
"gatewayPriority for merchant: {:?} listOfGateway: {:?}",
682689
macc.merchantId,
683690
list_of_gateway
684691
);
685692
match list_of_gateway.as_slice() {
686693
[] => {
687-
logger::info!(
694+
logger::debug!(
688695
tag = "gatewayPriority emptyList",
689696
"Can't get gatewayPriority for merchant: {:?} . Input: {:?}",
690697
macc.merchantId,
@@ -693,7 +700,7 @@ pub async fn get_gateway_priority(
693700
default_gateway_priority_logic_output()
694701
}
695702
res => {
696-
logger::info!(
703+
logger::debug!(
697704
tag = "gatewayPriority decoding",
698705
"Decoded successfully. Input: {:?} output: {:?}",
699706
t,
@@ -827,7 +834,7 @@ async fn get_priority_logic_script_from_tenant_config(
827834
Some(tenant_config) => {
828835
match (tenant_config.filterDimension, tenant_config.filterGroupId) {
829836
(Some(filter_dimension), Some(filter_group_id)) => {
830-
logger::info!(
837+
logger::debug!(
831838
tag = "getPriorityLogicScriptFromTenantConfig",
832839
"Filter dimension found: {:?}",
833840
filter_dimension
@@ -841,7 +848,7 @@ async fn get_priority_logic_script_from_tenant_config(
841848
.await
842849
}
843850
_ => {
844-
logger::info!(
851+
logger::debug!(
845852
tag = "getPriorityLogicScriptFromTenantConfig",
846853
"Filter dimension and filter groupId are not present. Proceeding with default tenant config value."
847854
);
@@ -851,7 +858,7 @@ async fn get_priority_logic_script_from_tenant_config(
851858
}
852859
None => {
853860
let tenant_account_id = macc.tenantAccountId.clone().unwrap_or_default();
854-
logger::info!(
861+
logger::debug!(
855862
tag = "getPriorityLogicScriptFromTenantConfig",
856863
"Tenant Config not found for tenant account id {}",
857864
tenant_account_id
@@ -875,7 +882,7 @@ async fn get_pl_by_filter_dimension(
875882
get_pl_by_merchant_category_code(macc, filter_group_id, config_value).await
876883
}
877884
_ => {
878-
logger::info!(
885+
logger::debug!(
879886
tag = "getPLByFilterDimension",
880887
"Filter dimension is not supported. Proceeding with default tenant config value."
881888
);
@@ -898,14 +905,14 @@ async fn get_pl_by_merchant_category_code(
898905
.await
899906
{
900907
Some(tenant_config_filter) => {
901-
logger::info!(
908+
logger::debug!(
902909
tag = "getPLByMerchantCategoryCode",
903910
"Proceeding with tenant config filter priority logic."
904911
);
905912
decode_tenant_pl_config(tenant_config_filter.configValue, macc).await
906913
}
907914
None => {
908-
logger::info!(
915+
logger::debug!(
909916
tag = "getPLByMerchantCategoryCode",
910917
"Unable to find tenant config filter for groupId {:?} and dimension value {}",
911918
filter_group_id,
@@ -916,7 +923,7 @@ async fn get_pl_by_merchant_category_code(
916923
}
917924
}
918925
None => {
919-
logger::info!(
926+
logger::debug!(
920927
tag = "getPLByMerchantCategoryCode",
921928
"Merchant category code is not present for merchantId {:?}",
922929
macc.merchantId
@@ -932,7 +939,7 @@ async fn decode_tenant_pl_config(
932939
) -> (String, Option<String>) {
933940
match utils::either_decode_t::<TenantPLConfig>(&config_value) {
934941
Ok(tenant_pl_config) => {
935-
logger::info!(
942+
logger::debug!(
936943
tag = "decodeTenantPLConfig",
937944
"Tenant Priority Logic Config decoded successfully with name: {}",
938945
tenant_pl_config.name
@@ -1014,7 +1021,7 @@ pub async fn handle_fallback_logic(
10141021
.await;
10151022
match fallback_result {
10161023
EvaluationResult::PLResponse(gws, pl_data, logs, status) => {
1017-
logger::info!(
1024+
logger::debug!(
10181025
tag = "FALLBACK_PRIORITY_LOGIC_EXECUTION_",
10191026
"MerchantId: {:?} , Gateways: {:?}, Logs: {:?}",
10201027
macc.merchantId.clone(),
@@ -1032,7 +1039,7 @@ pub async fn handle_fallback_logic(
10321039
}
10331040
}
10341041
EvaluationResult::EvaluationError(priority_logic_data, err) => {
1035-
logger::info!(
1042+
logger::debug!(
10361043
tag = "FALLBACK_PRIORITY_LOGIC_EXECUTION_FAILURE",
10371044
"MerchantId: {:?} , Error: {:?}",
10381045
macc.merchantId,

0 commit comments

Comments
 (0)