Skip to content

Conversation

@neelkanth-kaushik
Copy link

@neelkanth-kaushik neelkanth-kaushik commented Nov 18, 2025

This pull request improves error handling and logging for retry attempts in the analytics consumer, making it easier to debug and monitor request failures. The changes include enhanced retry logging, better reporting when all retries are exhausted, and a minor update to exception logging.

Error handling and retry improvements:

  • Added detailed debug logging for each retry attempt in the send_request function, including the attempt number and elapsed time.
  • Added error logging when all retry attempts are exhausted, providing the final exception message for easier troubleshooting.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses GitHub issue 515 by improving retry logic and error logging in the Segment Analytics SDK. The changes focus on fixing the indentation of a return statement and enhancing retry behavior with better logging and attempt tracking.

  • Fixed indentation bug where return success was incorrectly inside the finally block
  • Added retry attempt logging with backoff details via on_backoff callback
  • Implemented attempt counting to log final error after exhausting all retries
  • Commented out redundant error logging in request.py

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
segment/analytics/request.py Commented out redundant error logging before re-raising exception, cleaned up trailing whitespace
segment/analytics/consumer.py Fixed return statement indentation bug, added retry attempt tracking and logging, added backoff callback for debugging

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants