feat: Add retention size limit for rotated files#1040
Conversation
This adds a new flag to the observer command to limit the size of the rotated files. When the rotated files exceed this size, the oldest files are deleted. Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new retention size limit feature for rotated files in the observer command. When rotated files exceed the specified size limit, the oldest files are automatically deleted to maintain storage bounds.
Key changes:
- Added
maxRetentionSizeconfiguration option with CLI flag support - Implemented size-based file cleanup logic that removes oldest files when size limit is exceeded
- Updated file rotation logic to track retained files and their sizes
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| observer/options.go | Adds maxRetentionSize field and WithMaxRetentionSize option function |
| observer/observer.go | Implements size-based cleanup logic in rotateMessages method |
| cmd/f3/observer.go | Adds CLI flag for retention size limit with megabyte conversion |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1040 +/- ##
==========================================
- Coverage 65.34% 64.94% -0.41%
==========================================
Files 80 80
Lines 9702 9733 +31
==========================================
- Hits 6340 6321 -19
- Misses 2867 2910 +43
- Partials 495 502 +7
🚀 New features to boost your workflow:
|
BigLep
left a comment
There was a problem hiding this comment.
High level question: do we feel good about the decision to be writing code to managing retention of files on disk rather than using other standard external tooling for this? (I'm no expert here but I assume this problem isn't unique to us and that there are general solutions that operators apply to prevent too much state from accumulating).
Thinking on this more, I can see why going with doing this within |
Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
This adds a new flag to the observer command to limit the size of the
rotated files. When the rotated files exceed this size, the oldest files
are deleted.
This is in support of #1041