mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-09 10:57:03 +08:00
feat(stats): 新增聚合读路径与回填机制并重构 dashboard/usage 读取链路
- 新增 stats_user_summary 及 user_daily_provider/api_format/cost_savings 等聚合表 - 扩展 stats_daily/hourly 有效 token 与响应时间等字段,maintenance runtime 同步写入 - 新增 backfill 模块与 --apply-backfills 命令补齐历史聚合数据 - 重写 dashboard_filters、usage_heatmap、user_rollups 查询改走聚合表 - 同步更新 baseline_v2.sql 与 migration 集,README/dev.sh 补充回填用法
This commit is contained in:
@@ -297,6 +297,7 @@ impl<'a> AdminAppState<'a> {
|
||||
json!(key.auto_delete_on_expiry),
|
||||
),
|
||||
("total_requests".to_string(), json!(key.total_requests)),
|
||||
("total_tokens".to_string(), json!(key.total_tokens)),
|
||||
("total_cost_usd".to_string(), json!(key.total_cost_usd)),
|
||||
(
|
||||
"wallet".to_string(),
|
||||
|
||||
@@ -1982,6 +1982,11 @@ impl<'a> AdminAppState<'a> {
|
||||
"total_requests"
|
||||
))
|
||||
.unwrap_or(0);
|
||||
let total_tokens = invalid_value!(imported_optional_u64(
|
||||
key.get("total_tokens"),
|
||||
"total_tokens"
|
||||
))
|
||||
.unwrap_or(0);
|
||||
let total_cost_usd = invalid_value!(imported_optional_f64(
|
||||
key.get("total_cost_usd"),
|
||||
"total_cost_usd"
|
||||
@@ -2047,6 +2052,7 @@ impl<'a> AdminAppState<'a> {
|
||||
|| key.contains_key("expires_at")
|
||||
|| key.contains_key("auto_delete_on_expiry")
|
||||
|| key.contains_key("total_requests")
|
||||
|| key.contains_key("total_tokens")
|
||||
|| key.contains_key("total_cost_usd")
|
||||
{
|
||||
stats.errors.push(format!(
|
||||
@@ -2077,6 +2083,7 @@ impl<'a> AdminAppState<'a> {
|
||||
expires_at_unix_secs,
|
||||
auto_delete_on_expiry,
|
||||
total_requests,
|
||||
total_tokens,
|
||||
total_cost_usd,
|
||||
})
|
||||
.await?;
|
||||
@@ -2169,6 +2176,11 @@ impl<'a> AdminAppState<'a> {
|
||||
"total_requests"
|
||||
))
|
||||
.unwrap_or(0);
|
||||
let total_tokens = invalid_value!(imported_optional_u64(
|
||||
key.get("total_tokens"),
|
||||
"total_tokens"
|
||||
))
|
||||
.unwrap_or(0);
|
||||
let total_cost_usd = invalid_value!(imported_optional_f64(
|
||||
key.get("total_cost_usd"),
|
||||
"total_cost_usd"
|
||||
@@ -2225,6 +2237,7 @@ impl<'a> AdminAppState<'a> {
|
||||
|| key.contains_key("auto_delete_on_expiry")
|
||||
|| key.contains_key("force_capabilities")
|
||||
|| key.contains_key("total_requests")
|
||||
|| key.contains_key("total_tokens")
|
||||
|| key.contains_key("total_cost_usd")
|
||||
{
|
||||
stats.errors.push(
|
||||
@@ -2263,6 +2276,7 @@ impl<'a> AdminAppState<'a> {
|
||||
expires_at_unix_secs,
|
||||
auto_delete_on_expiry,
|
||||
total_requests,
|
||||
total_tokens,
|
||||
total_cost_usd,
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user