mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-28 07:36:38 +08:00
9de240f034
- Add NodeMetric/TunnelMetric/ServiceMonitor models and repository methods - Implement metrics ingestion service with per-minute bucket aggregation - Add health checker for node connectivity monitoring - Wire node metrics from WebSocket SystemInfo messages - Add tunnel metrics ingestion from flow upload endpoint - Create monitoring REST API endpoints for nodes, tunnels, services - Implement service monitor CRUD and execution (TCP/ICMP checks) - Add MonitorPermission for non-admin access control - Create frontend monitor page with node/tunnel/service views - Add tunnel metrics ingestion from agent flow reports - Include schema migration for tunnel_metric unique index - Fix tunnel entry port conflict validation to use transaction Entire-Checkpoint: 030821a7c8e3
41 lines
1.8 KiB
Markdown
41 lines
1.8 KiB
Markdown
# 040 - Service Monitor Limits Config + UI Hints
|
|
|
|
## Goal
|
|
Make service monitor interval/timeout constraints configurable (instead of hard-coded clamps) and make the UI clearly communicate the effective limits.
|
|
|
|
## Current Pain
|
|
- Backend clamps `intervalSec` and `timeoutSec` with hard-coded constants.
|
|
- Checker scan cadence is also hard-coded, so users can set values that will never be honored.
|
|
- Frontend form does not explain allowed ranges or why values may change.
|
|
|
|
## Approach
|
|
- Add frontend-configurable limits stored in `vite_config` (with safe defaults matching current behavior).
|
|
- Backend always normalizes using the configured limits.
|
|
- Expose the current limits via a monitoring endpoint so the UI can render accurate hints.
|
|
- Frontend shows min/max and validates before submit.
|
|
- Admin can edit the limits on `/config`.
|
|
|
|
## Config Keys (vite_config)
|
|
- `service_monitor_checker_scan_interval_sec` (default: 30)
|
|
- `service_monitor_min_interval_sec` (default: 30; auto-raised to at least scan interval)
|
|
- `service_monitor_default_interval_sec` (default: 60)
|
|
- `service_monitor_min_timeout_sec` (default: 1)
|
|
- `service_monitor_default_timeout_sec` (default: 5)
|
|
- `service_monitor_max_timeout_sec` (default: 60)
|
|
|
|
## Checklist
|
|
Backend:
|
|
- [x] Introduce shared `ServiceMonitorLimits` config loader.
|
|
- [x] Use limits for create/update normalization.
|
|
- [x] Use limits in checker (scan interval + timeout clamp).
|
|
- [x] Add `GET /api/v1/monitor/services/limits` to return current limits.
|
|
|
|
Frontend:
|
|
- [x] Fetch limits once and render input descriptions.
|
|
- [x] Validate interval/timeout client-side and show inline errors.
|
|
- [x] Add `/config` items to edit the `vite_config` keys.
|
|
|
|
Verification:
|
|
- [x] `cd go-backend && go test ./... -count=1`
|
|
- [x] `cd vite-frontend && npm run lint && npm run build`
|