feat(health): add model and provider health monitoring

- Rename the original health monitor to endpoint health monitor
- Add tab navigation for endpoint, model, and provider health views
- Add model health monitor cards with availability, latency, first-byte latency, and 60-point history
- Add admin-only provider health monitor with collapsible active-provider sections
- Show per-provider model health cards after expanding a provider
- Add backend model health and provider health monitor payload builders
- Add admin endpoint for provider health monitoring
- Add provider-scoped usage breakdown filtering for per-provider model statistics
- Add frontend API types and request helpers for model/provider health data
- Add demo mock data for model and provider health monitoring
- Fix model health timeline time-unit handling so request history segments render correctly

Verification:
- cargo fmt
- npm run type-check
- npm run build
- cargo test -p aether-gateway health_models
- cargo test -p aether-gateway health_providers
- cargo test -p aether-gateway gateway_exposes_frontdoor_manifest_without_proxying_upstream
This commit is contained in:
AAEE86
2026-05-28 12:00:20 +08:00
parent 14ad6e9b75
commit 4ce056fe45
24 changed files with 1914 additions and 17 deletions
@@ -1,9 +1,10 @@
use super::{
build_api_format_health_monitor_payload, build_public_auth_modules_status_payload,
build_public_catalog_models_payload, build_public_catalog_search_models_payload,
build_public_providers_payload, capability_detail_by_name, ldap_module_config_is_valid,
sanitize_public_model_config_for_user, serialize_public_capability, supported_capability_names,
ApiFormatHealthMonitorOptions, PUBLIC_CAPABILITY_DEFINITIONS,
build_api_format_health_monitor_payload, build_model_health_monitor_payload,
build_public_auth_modules_status_payload, build_public_catalog_models_payload,
build_public_catalog_search_models_payload, build_public_providers_payload,
capability_detail_by_name, ldap_module_config_is_valid, sanitize_public_model_config_for_user,
serialize_public_capability, supported_capability_names, ApiFormatHealthMonitorOptions,
ModelHealthMonitorOptions, PUBLIC_CAPABILITY_DEFINITIONS,
};
use crate::control::GatewayPublicRequestContext;
use crate::handlers::shared::{
@@ -426,6 +427,43 @@ pub(crate) async fn maybe_build_local_public_support_response(
.await?;
return Some(Json(payload).into_response());
}
if decision.route_kind.as_deref() == Some("health_models")
&& request_context.request_path == "/api/public/health/models"
{
let lookback_hours = query_param_value(
request_context.request_query_string.as_deref(),
"lookback_hours",
)
.and_then(|value| value.parse::<u64>().ok())
.filter(|value| (1..=168).contains(value))
.unwrap_or(6);
let model_limit = query_param_value(
request_context.request_query_string.as_deref(),
"model_limit",
)
.and_then(|value| value.parse::<usize>().ok())
.filter(|value| (1..=50).contains(value))
.unwrap_or(12);
let per_model_limit = query_param_value(
request_context.request_query_string.as_deref(),
"per_model_limit",
)
.and_then(|value| value.parse::<usize>().ok())
.filter(|value| (10..=500).contains(value))
.unwrap_or(100);
let payload = build_model_health_monitor_payload(
state,
lookback_hours,
model_limit,
per_model_limit,
ModelHealthMonitorOptions {
include_provider_count: false,
},
)
.await?;
return Some(Json(payload).into_response());
}
}
if decision.route_family.as_deref() == Some("capabilities") {