Add monitord, a rotating CSV logger - #42
Merged
Merged
Conversation
monitord is a headless daemon that samples every metric on the same clock and writes rotating, human-readable CSV. It is the background-sampler half of the persistence roadmap, aimed at a different consumer than the app's own history: other processes that want to correlate performance with temperature or throttling. - MonitorCore: LogRetention (window, cadence, period) and CSVLogFormat (wide CSV, reusing the CSVExport helpers). Pure and testable. - MonitorLog: CSVLogSink, an actor that writes one file per cadence period (hourly for sub-day retention, daily otherwise), rolls on the boundary, and sweeps old files on a slow timer. - monitord: runs the existing Sampler with the sink; --dir, --retention, --interval; clean shutdown on SIGINT/SIGTERM. The app still has no code path that reaches the filesystem: monitor does not link MonitorLog. Closes #41.
Closed
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.
Closes #41.
Adds
monitord, a headless daemon that samples every metric on the same clock and writes rotating, human-readable CSV — the background-sampler half of the persistence roadmap, aimed at a different consumer than the app's own history: other processes that want to correlate performance with temperature or throttling.LogRetention(window, cadence, period) andCSVLogFormat(wide CSV, reusing theCSVExporthelpers). Pure and testable.CSVLogSink, an actor that writes one file per cadence period (hourly for sub-day retention, daily otherwise), rolls on the boundary, and sweeps old files on a slow timer.Samplerwith the sink;--dir,--retention,--interval; clean shutdown on SIGINT/SIGTERM.The app still has no code path that reaches the filesystem:
monitordoes not linkMonitorLog.Format
Rotation
Verification
swift build && swift test— 227 tests pass (6 new).swiftformat --lint— clean.swift build -c release— clean.monitordagainst a temp dir: correct hourly file, hostname, timestamps, wide rows.