Probes refresh rate#82
Merged
Merged
Conversation
Each probe now declares its refresh policy via GetRefreshPolicy(): - LinGeneralAnalyzer: 1h interval, proactive (log data can roll over) - SmartHealthAnalyzer: 4h interval, not proactive (data persists) - WinGeneralAnalyzer: 1h interval, proactive (WMI status transient) Probes collect data in Refresh() and cache results internally. GetStatus() and GetRawData() return cached data without I/O. LinGeneralAnalyzer no longer collects in constructor. Update IProbeMock and SmartHealthAnalyzer tests accordingly.
Replace monolithic collectAndPublish with per-probe staleness tracking: - refreshStaleProbes: only refreshes probes past their declared interval - publishFromCache: builds status from cached probe data without I/O - refreshAllProbes: used by POST /refresh for manual force-refresh Agent startup refreshes only proactive probes (log data). Non-proactive probes (SMART) stay uncollected until a monitor connects. SSE client connection triggers conditional refresh of stale probes via new HttpServer::setOnClientConnectedCallback. Background thread checks proactive probes every minute and pushes SSE updates when data changes. Graceful shutdown: signal handler sets atomic flag, background thread joins after server.listen() returns.
LinGeneralAnalyzer now detects journalctl at construction time. When available, Refresh() runs journalctl -k --cursor-file instead of dmesg. journalctl with --cursor-file reads only new entries since last cursor, enabling incremental error accumulation without re-reading the full kernel ring buffer. The cursor file at /tmp/rdhm-journal-cursor is naturally cleaned on reboot, matching -k (current boot) semantics. Falls back to popen(dmesg) on systems without systemd.
Monitor no longer triggers a forced refresh on every observe(). Instead, connecting the SSE stream is sufficient: the agent-side SSE handler conditionally refreshes stale probes and pushes a statusChanged event as the first message. This avoids redundant refreshes when the monitor reconnects frequently. POST /api/v1/refresh remains available for manual user-triggered refresh via the UI button.
8ef5c66 to
cbee8a6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.