fix(stats): scope group usage by providers and add ungrouped view

This commit is contained in:
wangpengxiang
2026-09-21 12:49:48 +08:00
parent ba7c9f8b27
commit a9a7c64e5d
15 changed files with 622 additions and 48 deletions
@@ -1060,6 +1060,9 @@ pub struct UsageAuditAggregationQuery {
#[derive(Debug, Clone, PartialEq, Eq, Default, serde::Serialize, serde::Deserialize)]
pub struct UsageAuditSummaryQuery {
/// Optional provider-name allowlist, intersected with provider_name; empty matches nothing.
#[serde(default)]
pub provider_names: Option<Vec<String>>,
pub created_from_unix_secs: u64,
pub created_until_unix_secs: u64,
pub user_id: Option<String>,
@@ -1453,6 +1456,9 @@ pub enum UsageTimeSeriesGranularity {
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct UsageTimeSeriesQuery {
/// Optional provider-name allowlist, intersected with provider_name; empty matches nothing.
#[serde(default)]
pub provider_names: Option<Vec<String>>,
pub created_from_unix_secs: u64,
pub created_until_unix_secs: u64,
pub granularity: UsageTimeSeriesGranularity,
@@ -1487,6 +1493,9 @@ pub enum UsageLeaderboardGroupBy {
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct UsageLeaderboardQuery {
/// Optional provider-name allowlist, intersected with provider_name; empty matches nothing.
#[serde(default)]
pub provider_names: Option<Vec<String>>,
pub created_from_unix_secs: u64,
pub created_until_unix_secs: u64,
pub group_by: UsageLeaderboardGroupBy,