Repository navigation
feat: export log retention metrics - #35
Merged
Merged
Conversation
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.
This adds opt-in Prometheus text exposition for log retention through
--metrics-file PATHonfailedandrotate. Without the flag, nothing changes and no metrics file is written.The file carries three series.
eb_keep_logs_logs_kept_totalcounts kept-log operations.eb_keep_logs_bytes_kept_totalcounts the bytes they wrote.eb_keep_logs_last_prune_timestamp_secondsrecords the Unix time when the last rotation finished.Each writer takes a sidecar lock before it reads the old values. Under that lock it picks the completion time, so the timestamp never moves backwards when rotations finish out of order. The
EB_KEEP_LOGS_NOWoverride affects run-age checks only, not this timestamp. Each command keeps the values the other command owns. The new content goes to a temporary file in the target directory, gets synced, and then replaces the target with an atomic rename.New metrics files get mode
0644. A replaced file keeps its exact old mode, even under a strictumask. If restoring the mode fails, the command removes the temporary file and leaves the old exposition alone. Counters use the full unsigned 64-bit range. On overflow or a parse error the previous file stays as it was. The shell script and the Zig build behave the same way here.Alongside the file handling, the docs gain a how-to for feeding the metrics file to the
node_exportertextfile collector, plus updates to the CLI reference and the local-time explanation. CI and release workflows pinpromtool3.7.3, and the new integration and unit tests runpromtool check metricson the output.