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:
1 parent
c605a0f316
commit
ac92dd5ac4
12 files changed
+462
-1
No files matched your search
@@ -136,6 +136,17 @@ the single and multi start paths are covered) and surfaced via
|
||||
call `check_live_ready` first. `LIVE_CONFIRMATION` must equal
|
||||
`"I UNDERSTAND THE RISK"` — keep it a phrase, not a boolean.
|
||||
|
||||
## Observability
|
||||
|
||||
- `app/metrics.py` renders Prometheus text at `GET /api/metrics` straight from
|
||||
the manager status — no client library. Keep new series out of hot loops.
|
||||
- `app/logs.py` keeps a small in-memory ring of log records, exposed at
|
||||
`GET /api/logs` and shown in the dashboard. `Runtime._log_event` mirrors bot
|
||||
events into the logger so the panel is useful (uvicorn's own loggers do not
|
||||
propagate to the root handler).
|
||||
- `docs/runbook.md` is the operations guide; update it when deploy or
|
||||
recovery steps change.
|
||||
|
||||
## Risk controls & notifications
|
||||
|
||||
- `app/engine/risk.py` (`RiskManager`) tracks daily loss, drawdown, position cap
|
||||
|
||||
Reference in new issue
Block a user