Avoid warning for empty files too small to fingerprint#25897
Conversation
Signed-off-by: Angel Coronel <angelcoronel15@gmail.com>
|
Thank you for your contribution! Before we can merge this PR, please sign our Contributor License Agreement. To sign, copy and post the phrase below as a new comment on this PR.
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e8f82d1f3a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| match error.kind() { | ||
| ErrorKind::UnexpectedEof => { | ||
| if !known_small_files.contains_key(path) { | ||
| if file_size != Some(0) && !known_small_files.contains_key(path) { |
There was a problem hiding this comment.
Keep remove_after tracking for empty files
When the file source uses checksum fingerprinting with remove_after_secs, this branch now suppresses both the warning and the insertion into known_small_files for zero-byte files. The cleanup path deletes only entries from known_small_files after the grace period (lib/file-source/src/file_server.rs cleanup loop), so an empty matched file is no longer removed even though it is already at EOF and previously was tracked for removal. Suppress emit_file_checksum_failed separately while still recording the path for remove_after_secs cleanup.
Useful? React with 👍 / 👎.
Summary
This PR fixes #1065 by avoiding the
Currently ignoring file too small to fingerprintwarning for empty files.The existing behavior emits the same warning for empty files and for non-empty files that are too small to fingerprint. Empty files can be common in production logging environments, especially with short-lived jobs or pods, so warning on them can create noisy logs without giving users actionable information.
This change keeps the existing warning behavior for non-empty files that are too small to fingerprint, but skips the warning for empty files.
Vector configuration
No full Vector configuration was used for this change. The behavior is covered at the file-source-common fingerprinter level with a targeted unit test.
How did you test this PR?
Tested locally on macOS with targeted file-source-common tests.
Commands run:
Results:
no_error_on_empty_filepassedfingerprintertest filter passed: 8 passed, 0 failedcargo fmt --checkpassedgit diff --checkpassedChange Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
Notes
This PR includes a changelog fragment: