mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-09 18:59:50 +08:00
Merge user accounts and usage reporting into one page with a combined ranking and account table, shared precise time ranges, and simpler range labels. Parse overview metadata once through a schema-only view migration and disable JIT locally for bucket rebuilds. Preserve automatic backfills. Add redacted OAuth refresh diagnostics, bucket failure context, and regression coverage. Resolve strict Clippy warnings.
62 lines
1.7 KiB
Rust
62 lines
1.7 KiB
Rust
use crate::handlers::admin::request::{AdminAppState, AdminRequestContext};
|
|
use crate::GatewayError;
|
|
use axum::{body::Body, response::Response};
|
|
|
|
mod analytics_routes;
|
|
mod cost_routes;
|
|
mod leaderboard;
|
|
mod leaderboard_routes;
|
|
mod provider_quota_routes;
|
|
mod range;
|
|
pub(crate) use self::range::{
|
|
parse_bounded_u32, precise_admin_stats_time_range, resolve_admin_usage_time_range,
|
|
resolve_precise_time_bounds, resolve_usage_time_bounds,
|
|
};
|
|
pub(crate) use aether_admin::observability::stats::{
|
|
admin_stats_bad_request_response, aggregate_usage_stats, round_to, AdminStatsTimeRange,
|
|
AdminStatsUsageFilter,
|
|
};
|
|
|
|
pub(crate) async fn maybe_build_local_admin_stats_response(
|
|
state: &AdminAppState<'_>,
|
|
request_context: &AdminRequestContext<'_>,
|
|
) -> Result<Option<Response<Body>>, GatewayError> {
|
|
if request_context.route_family() != Some("stats_manage") {
|
|
return Ok(None);
|
|
}
|
|
|
|
if let Some(response) =
|
|
provider_quota_routes::maybe_build_local_admin_stats_provider_quota_response(
|
|
state,
|
|
request_context,
|
|
)
|
|
.await?
|
|
{
|
|
return Ok(Some(response));
|
|
}
|
|
|
|
if let Some(response) =
|
|
analytics_routes::maybe_build_local_admin_stats_analytics_response(state, request_context)
|
|
.await?
|
|
{
|
|
return Ok(Some(response));
|
|
}
|
|
|
|
if let Some(response) =
|
|
cost_routes::maybe_build_local_admin_stats_cost_response(state, request_context).await?
|
|
{
|
|
return Ok(Some(response));
|
|
}
|
|
|
|
if let Some(response) = leaderboard_routes::maybe_build_local_admin_stats_leaderboard_response(
|
|
state,
|
|
request_context,
|
|
)
|
|
.await?
|
|
{
|
|
return Ok(Some(response));
|
|
}
|
|
|
|
Ok(None)
|
|
}
|