Skip to content

feat: add dead-letter when reach max retries - #10

Merged
dwego merged 2 commits into
devfrom
feat-dead-letter
Jul 18, 2026
Merged

feat: add dead-letter when reach max retries#10
dwego merged 2 commits into
devfrom
feat-dead-letter

Conversation

@dwego

@dwego dwego commented Jul 18, 2026

Copy link
Copy Markdown
Owner

This pull request implements a "dead-letter" mechanism for failed log batches in the sink, ensuring that logs are not lost if delivery to the server fails after all retries. It also updates error messages to English and adds a test to verify the new behavior.

Dead-letter handling for failed batches:

  • Added a write_dead_letter function to src/sink.rs that writes failed log batches to a logtap.failed.jsonl file after all retry attempts are exhausted, instead of dropping them. This ensures failed logs can be recovered or replayed later. [1] [2]
  • Updated the retry logic in flush_with_retry to call write_dead_letter and log the file path when abandoning a batch.

Error message and logging improvements:

  • Changed all error and status messages from Portuguese to English for consistency and clarity. [1] [2]

Testing:

  • Added a test, sink_writes_batch_to_dead_letter_file_after_exhausting_retries, in tests/sink_test.rs to verify that failed batches are correctly written to the dead-letter file.

@dwego dwego self-assigned this Jul 18, 2026
@dwego
dwego merged commit aaec193 into dev Jul 18, 2026
1 check passed
@dwego
dwego deleted the feat-dead-letter branch July 18, 2026 03:14
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.

1 participant