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

fix(events): suppress shadow UCS connector logs (#13068)

gopikrishna000c16116bec774
diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs
index 1802c4d8b2..cea2ec52f7 100644
--- a/crates/router/src/core/unified_connector_service.rs
+++ b/crates/router/src/core/unified_connector_service.rs
@@ -2781,24 +2781,23 @@ where
}
};
- // Emit the Hyperswitch -> UCS connector event (shared with the other wrapper); it lands in
- // connector_events with `destination = unified_connector_service`, `execution_mode` primary
- // or shadow.
- emit_ucs_connector_event(
- state,
- std::any::type_name::<T>(),
- connector_name,
- payment_id,
- merchant_id,
- refund_id,
- dispute_id,
- payout_id,
- grpc_request_body,
- status_code,
- response_body,
- external_latency,
- execution_mode,
- );
+ if let ExecutionMode::Primary = execution_mode {
+ emit_ucs_connector_event(
+ state,
+ std::any::type_name::<T>(),
+ connector_name,
+ payment_id,
+ merchant_id,
+ refund_id,
+ dispute_id,
+ payout_id,
+ grpc_request_body,
+ status_code,
+ response_body,
+ external_latency,
+ execution_mode,
+ );
+ }
// Set external latency on router data
router_result.map(|mut router_data| {
@@ -2913,24 +2912,23 @@ where
}
};
- // Emit the Hyperswitch -> UCS connector event (shared with the other wrapper); it lands in
- // connector_events with `destination = unified_connector_service`, `execution_mode` primary
- // or shadow.
- emit_ucs_connector_event(
- state,
- std::any::type_name::<T>(),
- connector_name,
- payment_id,
- merchant_id,
- refund_id,
- dispute_id,
- payout_id,
- grpc_request_body,
- status_code,
- response_body,
- external_latency,
- execution_mode,
- );
+ if let ExecutionMode::Primary = execution_mode {
+ emit_ucs_connector_event(
+ state,
+ std::any::type_name::<T>(),
+ connector_name,
+ payment_id,
+ merchant_id,
+ refund_id,
+ dispute_id,
+ payout_id,
+ grpc_request_body,
+ status_code,
+ response_body,
+ external_latency,
+ execution_mode,
+ );
+ }
// Set external latency on router data
router_result.map(|mut router_data| {
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 980ab65053..ee09dc61ca 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -192,13 +192,23 @@ impl SessionState {
ExecutionMode::Shadow => Some("shadow"),
ExecutionMode::NotApplicable => None,
};
+ let config_override = match unified_connector_service_execution_mode {
+ ExecutionMode::Shadow => Some(
+ serde_json::json!({
+ "events": {
+ "enabled": false
+ }
+ })
+ .to_string(),
+ ),
+ _ => None,
+ };
GrpcHeadersUcs::builder()
.tenant_id(tenant_id)
.request_id(request_id)
.shadow_mode(shadow_mode)
.proxy_name(proxy_name)
- // no override: UCS emits in all modes, distinguished downstream by `execution_mode`
- .config_override(None)
+ .config_override(config_override)
}
#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
pub fn get_recovery_grpc_headers(&self) -> GrpcRecoveryHeaders {