From 3140dac7cd8ee78aa6d000d26fb9dd8faa21d000 Mon Sep 17 00:00:00 2001 From: Ripley Date: Sun, 10 May 2026 20:15:31 -0500 Subject: [PATCH] =?UTF-8?q?docs:=20update=20VERSION,=20HISTORY,=20FUTURE?= =?UTF-8?q?=20for=20v0.0.4=20=E2=80=94=20gateway=20collector=20complete?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FUTURE.md | 15 ++++----------- HISTORY.md | 17 +++++++++++++++++ VERSION.md | 12 ++++++++++++ 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/FUTURE.md b/FUTURE.md index b624778..c25cb6e 100644 --- a/FUTURE.md +++ b/FUTURE.md @@ -3,7 +3,7 @@ **This document tracks potential future enhancements for Mission Control.** **Last Updated:** 2026-05-10 -**Current Version:** v0.0.3 +**Current Version:** v0.0.4 ## How to Use This Document @@ -36,18 +36,11 @@ Items are grouped under their priority section heading (`## 🔴 CRITICAL`, `## ### 🟠 Gateway Data Collection Service — HIGH **Priority:** HIGH -**Status:** IN PROGRESS +**Status:** DONE ✅ **Added:** 2026-05-10 by Ripley +**Completed:** 2026-05-11 -**Description:** -Port the dashboard's Go data collection (`refresh.go`, `refresh_sessions.go`, `refresh_tokens.go`, etc.) to Python services that poll the OpenClaw gateway. - -**Implementation Notes:** -- Create `app/services/monitoring/gateway_collector.py` -- Reuse existing `gateway_rpc.py` for all RPC calls -- Poll: usage.cost, usage.status, cron.list/status, sessions.list/preview, agents.list, health, status -- Run as background asyncio task with configurable intervals -- Store collected data in new PostgreSQL models +GatewayCollectorService created in `src/backend/app/services/monitoring/`. Background asyncio task polls gateway RPC endpoints (cost, cron, sessions, health) and upserts into monitoring models. Configurable intervals via env vars. Startup/shutdown integrated into main.py lifespan. ### 🟠 Monitoring Database Models — HIGH **Priority:** HIGH diff --git a/HISTORY.md b/HISTORY.md index c1acaf1..a89a571 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,22 @@ # Mission Control — Changelog +## v0.0.4 + +### Added +- **Gateway Data Collection Service** — Background asyncio task that polls gateway RPC endpoints and stores results in monitoring models + - `gateway_collector.py` — GatewayCollectorService class with per-endpoint collection methods (cost, cron, session, health) + - `models.py` — Pydantic schemas for parsing gateway RPC responses into typed Python objects + - `__init__.py` — Package init, exports GatewayCollectorService +- **Collector startup/shutdown** — Added to main.py lifespan; launches collector as background task when gateways exist +- **Configurable collection intervals** via env vars: COLLECTION_INTERVAL_COST (300s), COLLECTION_INTERVAL_CRON (60s), COLLECTION_INTERVAL_SESSION (30s), COLLECTION_INTERVAL_HEALTH (60s) +- **Upsert pattern** — All DB writes use insert-or-update to avoid duplicate records + +### Fixed +- Model FK definitions in monitoring.py and alert_rules.py: replaced `Column(UUID, ForeignKey(...))` with `Field(foreign_key=...)` to match codebase pattern +- Added missing `gateway_id` field to AlertRule model +- Removed OpenClawDBService inheritance from GatewayCollectorService (uses session factory pattern) +- Cleaned up duplicate/conflicting imports in collector + ## v0.0.3 ### Added diff --git a/VERSION.md b/VERSION.md index a945c33..12c324a 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1,5 +1,17 @@ # Mission Control — Version History +## v0.0.4 — 2026-05-11 +- **Phase 2: Gateway Data Collection Service** +- Created `src/backend/app/services/monitoring/` package with collector, Pydantic models, and init +- GatewayCollectorService: background asyncio task polling gateway RPC endpoints +- Collection methods: cost (usage.cost + usage.status), cron (cron.list), sessions (sessions.list + preview), health (health + status) +- Upsert pattern for all DB writes to avoid duplicates +- Configurable intervals via env vars (COST=300s, CRON=60s, SESSION=30s, HEALTH=60s) +- Collector startup/shutdown integrated into main.py lifespan +- Fixed model FK definitions: replaced Column(UUID, ForeignKey(...)) with Field(foreign_key=...) +- Added missing gateway_id field to AlertRule model +- Backend builds and runs successfully, collector logs correctly + ## v0.0.3 — 2026-05-11 - **Phase 2: Monitoring database models** - Add 7 new SQLModel tables for monitoring data collection