Observability: Prometheus metrics, log panel, runbook

- GET /api/metrics renders Prometheus text (equity, P&L, per-strategy
  equity/pnl/allocation/halted, info) with no client library.
- In-memory ring log handler (app/logs.py) exposed at GET /api/logs and a
  dashboard "Server logs" panel; Runtime mirrors bot events into the logger.
- docs/runbook.md covers deploys, the kill switch, resetting paper state and
  going live. Adds tests for metrics rendering and the log ring.
This commit is contained in:
matitos committed 2026-09-22 17:10:38 +00:00
1 parent c605a0f316
commit ac92dd5ac4
12 files changed
+462 -1

No files matched your search

+2
View File
@@ -10,6 +10,7 @@ from fastapi.middleware.cors import CORSMiddleware
from app.api.routes import router
from app.config import Settings, get_settings
from app.db import init_db
from app.logs import install_log_capture
from app.runtime import Runtime
@@ -22,6 +23,7 @@ def create_app(
@asynccontextmanager
async def lifespan(app: FastAPI) -> AsyncIterator[None]:
install_log_capture()
init_db()
app.state.runtime = runtime
yield