System Metrics
Memory usage, database size, uptime, request counters, response times, and error rates — all in real-time.
What's Monitored
Six key metrics collected with zero-cost atomics — no external monitoring agent needed.
Memory Monitoring
Tracks the server process RSS (Resident Set Size) in megabytes. Displayed as a real-time gauge on the dashboard.
Database Size
Reports the total size of .flindb/ including WAL files, per-entity data files, and backup snapshots.
Request Counters
Total requests served since server start. Tracked via AtomicU64 — no mutex overhead, no performance impact.
Response Time Tracking
Average response time in microseconds across all requests. Helps identify performance regressions instantly.
Error Rate
Total errors and error percentage. A spike in the error rate signals problems before users start complaining.
Auto-Refresh (5s)
The metrics dashboard refreshes every 5 seconds. No manual reloading — just leave it open and watch.
How It Works
Metrics are collected per-request with zero-cost atomic operations. No sampling, no approximation.
For every incoming request: ───────────────────────────────────────── 1. Instant::now() → Start timer 2. Handle request → Route, render, respond 3. record_request() → Atomically update: ├── TOTAL_REQUESTS → AtomicU64::fetch_add(1) ├── TOTAL_ERRORS → +1 if status >= 400 ├── TOTAL_RESPONSE_TIME → +elapsed microseconds ├── ROUTE_STATS → Per-route counters └── STATUS_COUNTS → Per-status-code counters No mutex. No lock contention. No overhead. Admin routes (/_flin/*) excluded from aggregates.
API Endpoint
A single endpoint returns all system metrics at once.
| Method | Endpoint | Description |
|---|---|---|
| GET | /_flin/api/metrics | Returns memory, database, uptime, request, and error metrics |
GET /_flin/api/metrics { "memory_mb": 24.5, "db_size_bytes": 1048576, "uptime_seconds": 3600, "total_requests": 12847, "total_errors": 23, "avg_response_time_us": 1250 }
Zero-Cost Monitoring
All metrics are collected with AtomicU64 counters — no external monitoring agent, no performance overhead, no configuration. The metrics dashboard works from the first request. Leave it open during development, use it for production health checks.
FLIN vs. Traditional Stacks
Traditional Stack
- Install Prometheus for metrics collection and alerting
- Set up Grafana for visualization and dashboards
- Configure StatsD or custom middleware for request timing
- Deploy a separate monitoring agent on each server
- Manage metric retention policies and storage costs
FLIN
- Metrics collected per-request with zero configuration
- Real-time dashboard with auto-refresh built in
- Memory, DB, uptime, requests, errors — all in one view
- Atomic counters with no lock contention or overhead
- Works in development and production identically