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(analytics): tolerate null destination and exclude shadow events from connector event logs (#13284)

gopikrishna0009ea5a74ff836
diff --git a/crates/analytics/src/connector_events/core.rs b/crates/analytics/src/connector_events/core.rs
index 59e549d415..ec16afe447 100644
--- a/crates/analytics/src/connector_events/core.rs
+++ b/crates/analytics/src/connector_events/core.rs
@@ -26,5 +26,9 @@ pub async fn connector_events_core(
}
}
.switch()?;
- Ok(data)
+
+ Ok(data
+ .into_iter()
+ .filter(|event| !event.is_shadow())
+ .collect())
}
diff --git a/crates/analytics/src/connector_events/events.rs b/crates/analytics/src/connector_events/events.rs
index 76abacaf29..12bf537ae6 100644
--- a/crates/analytics/src/connector_events/events.rs
+++ b/crates/analytics/src/connector_events/events.rs
@@ -93,10 +93,16 @@ pub struct ConnectorEventsResult {
#[serde(with = "common_utils::custom_serde::iso8601")]
pub created_at: PrimitiveDateTime,
pub method: Option<String>,
- #[serde(default = "default_connector_event_destination")]
- pub destination: common_enums::EventDestination,
+ pub destination: Option<String>,
+ /// Read to filter shadow-mode events out of the response; never surfaced to the caller.
+ #[serde(skip_serializing)]
+ pub execution_mode: Option<String>,
}
-fn default_connector_event_destination() -> common_enums::EventDestination {
- common_enums::EventDestination::Connector
+impl ConnectorEventsResult {
+ pub fn is_shadow(&self) -> bool {
+ self.execution_mode
+ .as_deref()
+ .is_some_and(|mode| mode.eq_ignore_ascii_case("shadow"))
+ }
}