mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 13:30:39 +08:00
feat(analytics): refactor and introduce analytics APIs to accommodate OrgLevel, MerchantLevel and ProfileLevel authentication (#5729)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Sampras Lopes <sampras.lopes@juspay.in>
This commit is contained in:
@ -7,6 +7,7 @@ use api_models::analytics::{
|
||||
use time::PrimitiveDateTime;
|
||||
|
||||
use crate::{
|
||||
enums::AuthInfo,
|
||||
query::{Aggregate, GroupByClause, ToSql, Window},
|
||||
types::{AnalyticsCollection, AnalyticsDataSource, LoadRow, MetricsResult},
|
||||
};
|
||||
@ -43,7 +44,7 @@ where
|
||||
async fn load_metrics(
|
||||
&self,
|
||||
dimensions: &[ApiEventDimensions],
|
||||
merchant_id: &common_utils::id_type::MerchantId,
|
||||
auth: &AuthInfo,
|
||||
filters: &ApiEventFilters,
|
||||
granularity: &Option<Granularity>,
|
||||
time_range: &TimeRange,
|
||||
@ -64,7 +65,7 @@ where
|
||||
async fn load_metrics(
|
||||
&self,
|
||||
dimensions: &[ApiEventDimensions],
|
||||
merchant_id: &common_utils::id_type::MerchantId,
|
||||
auth: &AuthInfo,
|
||||
filters: &ApiEventFilters,
|
||||
granularity: &Option<Granularity>,
|
||||
time_range: &TimeRange,
|
||||
@ -73,38 +74,17 @@ where
|
||||
match self {
|
||||
Self::Latency => {
|
||||
MaxLatency
|
||||
.load_metrics(
|
||||
dimensions,
|
||||
merchant_id,
|
||||
filters,
|
||||
granularity,
|
||||
time_range,
|
||||
pool,
|
||||
)
|
||||
.load_metrics(dimensions, auth, filters, granularity, time_range, pool)
|
||||
.await
|
||||
}
|
||||
Self::ApiCount => {
|
||||
ApiCount
|
||||
.load_metrics(
|
||||
dimensions,
|
||||
merchant_id,
|
||||
filters,
|
||||
granularity,
|
||||
time_range,
|
||||
pool,
|
||||
)
|
||||
.load_metrics(dimensions, auth, filters, granularity, time_range, pool)
|
||||
.await
|
||||
}
|
||||
Self::StatusCodeCount => {
|
||||
StatusCodeCount
|
||||
.load_metrics(
|
||||
dimensions,
|
||||
merchant_id,
|
||||
filters,
|
||||
granularity,
|
||||
time_range,
|
||||
pool,
|
||||
)
|
||||
.load_metrics(dimensions, auth, filters, granularity, time_range, pool)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user