Rootfix usage counter outbox

This commit is contained in:
fawney19
2026-05-19 00:30:24 +08:00
parent 19c8688eb1
commit 5eed329916
60 changed files with 4910 additions and 362 deletions

View File

@@ -727,6 +727,7 @@ pub fn build_admin_monitoring_system_status_payload_response(
active_streams: usize,
path_prefixes: &[&str],
recent_errors: usize,
usage_counter: Value,
) -> Response<Body> {
Json(json!({
"timestamp": timestamp.to_rfc3339(),
@@ -757,6 +758,7 @@ pub fn build_admin_monitoring_system_status_payload_response(
"path_prefixes": path_prefixes,
},
"recent_errors": recent_errors,
"usage_counter": usage_counter,
}))
.into_response()
}

View File

@@ -667,7 +667,9 @@ pub fn admin_stats_performance_percentiles_empty_response() -> Response<Body> {
Json(json!([])).into_response()
}
pub fn admin_stats_provider_performance_empty_response() -> Response<Body> {
pub fn admin_stats_provider_performance_empty_response(
usage_counter: serde_json::Value,
) -> Response<Body> {
Json(json!({
"summary": {
"request_count": 0,
@@ -678,6 +680,7 @@ pub fn admin_stats_provider_performance_empty_response() -> Response<Body> {
},
"providers": [],
"timeline": [],
"usage_counter": usage_counter,
}))
.into_response()
}
@@ -1093,6 +1096,7 @@ pub fn build_admin_stats_performance_percentiles_response_from_summaries(
pub fn build_admin_stats_provider_performance_response(
performance: &StoredUsageProviderPerformance,
usage_counter: serde_json::Value,
) -> Response<Body> {
let summary = &performance.summary;
let providers = performance
@@ -1158,6 +1162,7 @@ pub fn build_admin_stats_provider_performance_response(
},
"providers": providers,
"timeline": timeline,
"usage_counter": usage_counter,
}))
.into_response()
}

View File

@@ -861,6 +861,7 @@ pub fn build_admin_system_stats_payload(
active_providers: u64,
total_api_keys: u64,
total_requests: u64,
usage_counter: serde_json::Value,
) -> serde_json::Value {
json!({
"users": {
@@ -873,6 +874,7 @@ pub fn build_admin_system_stats_payload(
},
"api_keys": total_api_keys,
"requests": total_requests,
"usage_counter": usage_counter,
})
}