feat(analytics): added dispute as uri param to analytics info api (#3693)

This commit is contained in:
harsh-sharma-juspay
2024-02-19 18:14:51 +05:30
committed by GitHub
parent e0d8bb207e
commit 76ac1a753a
7 changed files with 86 additions and 1 deletions

View File

@ -130,7 +130,8 @@ impl AnalyticsDataSource for ClickhouseClient {
match table {
AnalyticsCollection::Payment
| AnalyticsCollection::Refund
| AnalyticsCollection::PaymentIntent => {
| AnalyticsCollection::PaymentIntent
| AnalyticsCollection::Dispute => {
TableEngine::CollapsingMergeTree { sign: "sign_flag" }
}
AnalyticsCollection::SdkEvents => TableEngine::BasicTree,
@ -374,6 +375,7 @@ impl ToSql<ClickhouseClient> for AnalyticsCollection {
Self::PaymentIntent => Ok("payment_intents".to_string()),
Self::ConnectorEvents => Ok("connector_events_audit".to_string()),
Self::OutgoingWebhookEvent => Ok("outgoing_webhook_events_audit".to_string()),
Self::Dispute => Ok("dispute".to_string()),
}
}
}

View File

@ -26,6 +26,11 @@ pub async fn get_domain_info(
download_dimensions: None,
dimensions: utils::get_api_event_dimensions(),
},
AnalyticsDomain::Dispute => GetInfoResponse {
metrics: utils::get_dispute_metrics_info(),
download_dimensions: None,
dimensions: utils::get_dispute_dimensions(),
},
};
Ok(info)
}

View File

@ -445,6 +445,7 @@ impl ToSql<SqlxClient> for AnalyticsCollection {
.attach_printable("ConnectorEvents table is not implemented for Sqlx"))?,
Self::OutgoingWebhookEvent => Err(error_stack::report!(ParsingError::UnknownError)
.attach_printable("OutgoingWebhookEvents table is not implemented for Sqlx"))?,
Self::Dispute => Ok("dispute".to_string()),
}
}
}

View File

@ -17,6 +17,7 @@ pub enum AnalyticsDomain {
Refunds,
SdkEvents,
ApiEvents,
Dispute,
}
#[derive(Debug, strum::AsRefStr, strum::Display, Clone, Copy)]
@ -28,6 +29,7 @@ pub enum AnalyticsCollection {
PaymentIntent,
ConnectorEvents,
OutgoingWebhookEvent,
Dispute,
}
#[allow(dead_code)]

View File

@ -1,5 +1,6 @@
use api_models::analytics::{
api_event::{ApiEventDimensions, ApiEventMetrics},
disputes::{DisputeDimensions, DisputeMetrics},
payments::{PaymentDimensions, PaymentMetrics},
refunds::{RefundDimensions, RefundMetrics},
sdk_events::{SdkEventDimensions, SdkEventMetrics},
@ -38,3 +39,11 @@ pub fn get_sdk_event_metrics_info() -> Vec<NameDescription> {
pub fn get_api_event_metrics_info() -> Vec<NameDescription> {
ApiEventMetrics::iter().map(Into::into).collect()
}
pub fn get_dispute_metrics_info() -> Vec<NameDescription> {
DisputeMetrics::iter().map(Into::into).collect()
}
pub fn get_dispute_dimensions() -> Vec<NameDescription> {
DisputeDimensions::iter().map(Into::into).collect()
}