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
@@ -62,6 +62,25 @@ pub(super) fn classify_admin_endpoints_family_route(
"admin:endpoints_health",
false,
))
} else if method == http::Method::GET && normalized_path == "/api/admin/endpoints/health/models"
{
Some(classified(
"admin_proxy",
"endpoints_health",
"health_models",
"admin:endpoints_health",
false,
))
} else if method == http::Method::GET
&& normalized_path == "/api/admin/endpoints/health/providers"
{
Some(classified(
"admin_proxy",
"endpoints_health",
"health_providers",
"admin:endpoints_health",
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/api/admin/endpoints/rpm/key/")
{
@@ -156,6 +156,7 @@ pub(super) fn classify_public_support_route(
| "/api/public/stats"
| "/api/public/global-models"
| "/api/public/health/api-formats"
| "/api/public/health/models"
)
{
let route_kind = match normalized_path {
@@ -166,6 +167,7 @@ pub(super) fn classify_public_support_route(
"/api/public/stats" => "stats",
"/api/public/global-models" => "global_models",
"/api/public/health/api-formats" => "health_api_formats",
"/api/public/health/models" => "health_models",
_ => "site_info",
};
Some(classified(
@@ -102,6 +102,44 @@ fn classifies_admin_endpoint_health_status_as_admin_proxy_route() {
assert!(!decision.is_execution_runtime_candidate());
}
#[test]
fn classifies_admin_endpoint_health_models_as_admin_proxy_route() {
let headers = headers(&[]);
let uri: Uri = "/api/admin/endpoints/health/models?lookback_hours=12"
.parse()
.expect("uri should parse");
let decision =
classify_control_route(&http::Method::GET, &uri, &headers).expect("route should classify");
assert_eq!(decision.route_class.as_deref(), Some("admin_proxy"));
assert_eq!(decision.route_family.as_deref(), Some("endpoints_health"));
assert_eq!(decision.route_kind.as_deref(), Some("health_models"));
assert_eq!(
decision.auth_endpoint_signature.as_deref(),
Some("admin:endpoints_health")
);
assert!(!decision.is_execution_runtime_candidate());
}
#[test]
fn classifies_admin_endpoint_health_providers_as_admin_proxy_route() {
let headers = headers(&[]);
let uri: Uri = "/api/admin/endpoints/health/providers?lookback_hours=12"
.parse()
.expect("uri should parse");
let decision =
classify_control_route(&http::Method::GET, &uri, &headers).expect("route should classify");
assert_eq!(decision.route_class.as_deref(), Some("admin_proxy"));
assert_eq!(decision.route_family.as_deref(), Some("endpoints_health"));
assert_eq!(decision.route_kind.as_deref(), Some("health_providers"));
assert_eq!(
decision.auth_endpoint_signature.as_deref(),
Some("admin:endpoints_health")
);
assert!(!decision.is_execution_runtime_candidate());
}
#[test]
fn classifies_admin_endpoint_key_rpm_as_admin_proxy_route() {
let headers = headers(&[]);
@@ -721,6 +721,25 @@ fn classifies_public_catalog_health_api_formats_as_public_support_route() {
assert!(!decision.is_execution_runtime_candidate());
}
#[test]
fn classifies_public_catalog_health_models_as_public_support_route() {
let headers = headers(&[]);
let uri: Uri = "/api/public/health/models?lookback_hours=12"
.parse()
.expect("uri should parse");
let decision =
classify_control_route(&http::Method::GET, &uri, &headers).expect("route should classify");
assert_eq!(decision.route_class.as_deref(), Some("public_support"));
assert_eq!(decision.route_family.as_deref(), Some("public_catalog"));
assert_eq!(decision.route_kind.as_deref(), Some("health_models"));
assert_eq!(
decision.auth_endpoint_signature.as_deref(),
Some("public:catalog")
);
assert!(!decision.is_execution_runtime_candidate());
}
#[test]
fn classifies_auth_registration_settings_as_public_support_route() {
let headers = headers(&[]);