Exclude unknown providers from usage aggregations

This commit is contained in:
fawney19
2026-05-06 13:40:18 +08:00
parent 94a6f315ca
commit 6fbb867f5f
7 changed files with 115 additions and 2 deletions

View File

@@ -163,12 +163,19 @@ pub(super) async fn build_admin_usage_aggregation_stats_response(
"api_format" => UsageAuditAggregationGroupBy::ApiFormat,
_ => unreachable!(),
};
let exclude_reserved_provider_labels = matches!(
group_by_query,
UsageAuditAggregationGroupBy::Model
| UsageAuditAggregationGroupBy::Provider
| UsageAuditAggregationGroupBy::ApiFormat
);
let usage = state
.aggregate_usage_audits(&UsageAuditAggregationQuery {
created_from_unix_secs,
created_until_unix_secs,
group_by: group_by_query,
limit,
exclude_reserved_provider_labels,
})
.await?;

View File

@@ -780,6 +780,7 @@ async fn dashboard_load_user_counts(
created_until_unix_secs,
group_by: UsageAuditAggregationGroupBy::User,
limit: 10_000,
exclude_reserved_provider_labels: false,
})
.await?;
let count = fallback.len() as u64;