- /api/health returns {status, uptime_sec, version, event_count,
ingest_rate_per_sec, ws_clients, tailer_files_watched, dedup_dropped,
process_resident_memory_bytes}; returns HTTP 503 with status='overloaded'
when maxEventCount is exceeded
- /api/metrics exposes the same counters in Prometheus text format;
fabric_status=0 when overloaded
- Add ServerMetrics.eventCount setter so both endpoints sync from store.size
(fixes fabric_event_count in /api/metrics showing 0 when events added directly)
- Wire --max-events CLI option into `fabric web`; pass maxEventCount and
deduplicator to createWebServer so the memory-bomb guard and dedup_dropped
reporting are actually activated
- Track tailerFilesWatched: set after tailer.start() and update on each event
for DirectoryTailer (uses activeFiles.length getter)
- Add import for Node net module used by systemd watchdog notify
- Add tests: overload guard returns 503, within-limit returns 200, Prometheus
reflects fabric_status=0 when overloaded
systemd service already has Restart=on-failure + WatchdogSec=30 (scripts/fabric-web.service);
liveness guard in server.ts calls process.exit(1) after 3 consecutive overload
checks, triggering systemd restart.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20 lines
486 B
Desktop File
20 lines
486 B
Desktop File
[Unit]
|
|
Description=FABRIC Web Dashboard
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=notify
|
|
NotifyAccess=all
|
|
WorkingDirectory=/home/coding/FABRIC
|
|
ExecStart=/usr/bin/node dist/cli.js web --port 3000 --source /home/coding/.needle/logs --otlp-http :4318
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
WatchdogSec=30
|
|
EnvironmentFile=/home/coding/.config/fabric/secrets.env
|
|
Environment=NODE_ENV=production
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
SyslogIdentifier=fabric-web
|
|
|
|
[Install]
|
|
WantedBy=default.target
|