feat(routing): Add audit trail for routing (#8188)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sarthak Soni
2025-06-03 02:23:56 +05:30
committed by GitHub
parent 1eea83359c
commit ebe44b9d7d
27 changed files with 1373 additions and 34 deletions

View File

@ -32,6 +32,7 @@ use crate::{
connector_events::events::ConnectorEventsResult,
disputes::{filters::DisputeFilterRow, metrics::DisputeMetricRow},
outgoing_webhook_event::events::OutgoingWebhookLogsResult,
routing_events::events::RoutingEventsResult,
sdk_events::events::SdkEventsResult,
types::TableEngine,
};
@ -150,6 +151,7 @@ impl AnalyticsDataSource for ClickhouseClient {
| AnalyticsCollection::SdkEventsAnalytics
| AnalyticsCollection::ApiEvents
| AnalyticsCollection::ConnectorEvents
| AnalyticsCollection::RoutingEvents
| AnalyticsCollection::ApiEventsAnalytics
| AnalyticsCollection::OutgoingWebhookEvent
| AnalyticsCollection::ActivePaymentsAnalytics => TableEngine::BasicTree,
@ -187,6 +189,7 @@ impl super::api_event::events::ApiLogsFilterAnalytics for ClickhouseClient {}
impl super::api_event::filters::ApiEventFilterAnalytics for ClickhouseClient {}
impl super::api_event::metrics::ApiEventMetricAnalytics for ClickhouseClient {}
impl super::connector_events::events::ConnectorEventLogAnalytics for ClickhouseClient {}
impl super::routing_events::events::RoutingEventLogAnalytics for ClickhouseClient {}
impl super::outgoing_webhook_event::events::OutgoingWebhookLogsFilterAnalytics
for ClickhouseClient
{
@ -236,6 +239,16 @@ impl TryInto<ConnectorEventsResult> for serde_json::Value {
}
}
impl TryInto<RoutingEventsResult> for serde_json::Value {
type Error = Report<ParsingError>;
fn try_into(self) -> Result<RoutingEventsResult, Self::Error> {
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
"Failed to parse RoutingEventsResult in clickhouse results",
))
}
}
impl TryInto<PaymentMetricRow> for serde_json::Value {
type Error = Report<ParsingError>;
@ -471,6 +484,7 @@ impl ToSql<ClickhouseClient> for AnalyticsCollection {
Self::DisputeSessionized => Ok("sessionizer_dispute".to_string()),
Self::ActivePaymentsAnalytics => Ok("active_payments".to_string()),
Self::Authentications => Ok("authentications".to_string()),
Self::RoutingEvents => Ok("routing_events_audit".to_string()),
}
}
}