Skip to content

Avoid warning for empty files too small to fingerprint#25897

Open
an-cor wants to merge 1 commit into
vectordotdev:masterfrom
an-cor:fix-small-empty-file-warning
Open

Avoid warning for empty files too small to fingerprint#25897
an-cor wants to merge 1 commit into
vectordotdev:masterfrom
an-cor:fix-small-empty-file-warning

Conversation

@an-cor

@an-cor an-cor commented Jul 20, 2026

Copy link
Copy Markdown

Summary

This PR fixes #1065 by avoiding the Currently ignoring file too small to fingerprint warning 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:

cargo test -p file-source-common no_error_on_empty_file
cargo test -p file-source-common fingerprinter
cargo fmt --check
git diff --check

Results:

  • no_error_on_empty_file passed
  • fingerprinter test filter passed: 8 passed, 0 failed
  • cargo fmt --check passed
  • git diff --check passed

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

References

Notes

This PR includes a changelog fragment:

changelog.d/1065-empty-file-fingerprint-warning.fix.md

Signed-off-by: Angel Coronel <angelcoronel15@gmail.com>
@an-cor
an-cor requested a review from a team as a code owner July 20, 2026 05:58
@github-actions

Copy link
Copy Markdown
Contributor

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.

Note: If the bot says your username was not found, the email used in your git commit may not be linked to your GitHub account. Fix this at github.com/settings/emails, then comment recheck to retry.


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.

@datadog-vectordotdev

Copy link
Copy Markdown

Pipelines

⚠️ Warnings

🚦 1 Pipeline job failed

CLA Assistant | CLAAssistant   View in Datadog   GitHub Actions

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: e8f82d1 | Docs | Give us feedback!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Only warn about small files when they are not empty

1 participant