fix(sidecar-v2): second-round review fixes

- cooldown_manager: move function-level imports to module top
- proxy.py: emergency_count counter now actually increments
- server.py: metrics reads emergency_count from proxy module
- dashboard.html: real JS CDN fallback (not just comment)
- requirements.txt: remove unused prometheus_client

Round 2 review residual fixes from 沈路明/陆怀瑾/梁思筑 feedback

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-06-25 17:53:37 +08:00
parent 4f415fb500
commit 474f1eddfd
5 changed files with 34 additions and 11 deletions
+3 -4
View File
@@ -19,7 +19,7 @@ from crypto import init_crypto, is_initialized
from pool_manager import PoolManager
from rate_limiter import PerBackendRateLimiter
from router import Router
from proxy import handle_proxy_request
from proxy import handle_proxy_request, get_emergency_count
from storage.db import init_db, create_tables, run_integrity_check, get_connection, _DB_PATH
from storage.backend_store import (
@@ -378,9 +378,8 @@ async def metrics() -> Response:
cooling_count = sum(1 for b in all_backends if b.status == "cooling")
lines.append(f"sidecar_cooldown_active {cooling_count}")
# Emergency count
emergency_count = _metrics_counters.get("emergency_count", 0)
lines.append(f"sidecar_emergency_count {emergency_count}")
# Emergency count (from proxy module)
lines.append(f"sidecar_emergency_count {get_emergency_count()}")
# DB sizes
from storage.db import get_db_sizes