mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
fix(admin): 修复 usage 观测全表扫描并下推聚合查询
- 收紧 admin usage/stats 默认时间范围和 active 轮询查询 - 将 summary/records/aggregation/time-series/leaderboard 下推到 SQL 侧 - 统一前端时间参数并补齐 admin usage/stats 回归测试
This commit is contained in:
@@ -45,6 +45,56 @@ impl AppState {
|
||||
.map_err(|err| GatewayError::Internal(err.to_string()))
|
||||
}
|
||||
|
||||
pub(crate) async fn count_usage_audits(
|
||||
&self,
|
||||
query: &usage::UsageAuditListQuery,
|
||||
) -> Result<u64, GatewayError> {
|
||||
self.data
|
||||
.count_usage_audits(query)
|
||||
.await
|
||||
.map_err(|err| GatewayError::Internal(err.to_string()))
|
||||
}
|
||||
|
||||
pub(crate) async fn aggregate_usage_audits(
|
||||
&self,
|
||||
query: &usage::UsageAuditAggregationQuery,
|
||||
) -> Result<Vec<usage::StoredUsageAuditAggregation>, GatewayError> {
|
||||
self.data
|
||||
.aggregate_usage_audits(query)
|
||||
.await
|
||||
.map_err(|err| GatewayError::Internal(err.to_string()))
|
||||
}
|
||||
|
||||
pub(crate) async fn summarize_usage_audits(
|
||||
&self,
|
||||
query: &usage::UsageAuditSummaryQuery,
|
||||
) -> Result<usage::StoredUsageAuditSummary, GatewayError> {
|
||||
self.data
|
||||
.summarize_usage_audits(query)
|
||||
.await
|
||||
.map_err(|err| GatewayError::Internal(err.to_string()))
|
||||
}
|
||||
|
||||
pub(crate) async fn summarize_usage_time_series(
|
||||
&self,
|
||||
query: &usage::UsageTimeSeriesQuery,
|
||||
) -> Result<Vec<usage::StoredUsageTimeSeriesBucket>, GatewayError> {
|
||||
self.data
|
||||
.summarize_usage_time_series(query)
|
||||
.await
|
||||
.map_err(|err| GatewayError::Internal(err.to_string()))
|
||||
}
|
||||
|
||||
pub(crate) async fn summarize_usage_leaderboard(
|
||||
&self,
|
||||
query: &usage::UsageLeaderboardQuery,
|
||||
) -> Result<Vec<usage::StoredUsageLeaderboardSummary>, GatewayError> {
|
||||
self.data
|
||||
.summarize_usage_leaderboard(query)
|
||||
.await
|
||||
.map_err(|err| GatewayError::Internal(err.to_string()))
|
||||
}
|
||||
|
||||
pub(crate) async fn summarize_usage_daily_heatmap(
|
||||
&self,
|
||||
query: &UsageDailyHeatmapQuery,
|
||||
|
||||
Reference in New Issue
Block a user