Skip to content

feat: throttle ZFS collector when no UI is connected (#126) - #127

Merged
gnacho merged 1 commit into
mainfrom
feat/126-ui-aware-collector
Sep 1, 2026
Merged

gnacho merged 1 commit into
mainfrom
feat/126-ui-aware-collector

Conversation

@gnacho

@gnacho gnacho commented Sep 1, 2026 •

Copy link
Copy Markdown
Owner

Closes #126.

What

The periodic ZFS collector was the main source of sudo/journald log volume on always-on nodes. This PR makes the collector aware of whether the web UI is connected via SSE.

How

  • Hub.SubscriberCount() exposes the number of open SSE streams.
  • ZpoolCollector receives the active/alert/idle intervals and the subscriber callback.
  • With the UI open: full collection every EASYZFS_ZPOOL_INTERVAL (default 10 s).
  • With the UI closed: cheap health/alert heartbeat every EASYZFS_ZPOOL_ALERT_INTERVAL (default 60 s), full collection only every EASYZFS_ZPOOL_IDLE_INTERVAL (default 300 s).
  • lightCollect runs only zpool list + zpool status --json per pool; fullCollect keeps datasets, snapshots, history and series.
  • Alerts still evaluate at least every minute; capacity series still persist at least every 10 minutes.

Validation

  • go test ./... passes.
  • Deployed a validation build on citadel-02 (192.168.1.101); service is healthy and journalctl shows 0 new easyzfs sudo log entries during a 5-minute idle window.

Env changes

  • EASYZFS_ZPOOL_INTERVAL now means seconds with UI open (default 10).
  • New: EASYZFS_ZPOOL_ALERT_INTERVAL (default 60) and EASYZFS_ZPOOL_IDLE_INTERVAL (default 300).

@gnacho
gnacho merged commit bd83616 into main Sep 1, 2026
3 checks passed
@gnacho
gnacho deleted the feat/126-ui-aware-collector branch September 1, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Throttle ZFS collector when no UI is connected

1 participant