getsentry / arroyo

A library to build streaming applications that consume from and produce to Kafka.
https://getsentry.github.io/arroyo/
Apache License 2.0
39 stars 6 forks source link

🤖 Handle Kafka OffsetOutOfRange Error Gracefully #347

Closed sentry-autofix-experimental[bot] closed 1 month ago

sentry-autofix-experimental[bot] commented 3 months ago

👋 Hi there! This PR was automatically generated 🤖

Triggered by evan.hicks@sentry.io

Fixes SNUBA-4KJ

The Kafka consumer encounters an OffsetOutOfRange error, indicating the requested offset is not available on the broker. This typically happens when trying to read from an offset that has already been deleted due to the topic's retention policy. The plan involves modifying the KafkaConsumer class to handle this error more gracefully by seeking to the earliest or latest offset available (based on configuration) instead of failing.

The steps that were performed:

  1. Add configuration option for handling OffsetOutOfRange
  2. Implement offset reset logic in poll method
  3. Update KafkaConsumer documentation

📣 Instructions for the reviewer which is you, yes you:

This will greatly help us improve the autofix system. Thank you! 🙏

If there are any questions, please reach out to the AI/ML Team on #proj-autofix

🤓 Stats for the nerds:

Prompt tokens: 86194 Completion tokens: 1702 Total tokens: 87896