Skip to content

Conversation

@KaviarasuSakthivadivel
Copy link
Contributor

Enhanced error logging and retry logic for authentication failures to provide better visibility into transient server errors and improve resilience against flaky authentication endpoints.

Changes:

  • Enhanced AuthorizationException.getMessage() to include HTTP status code and error description in a structured format
  • Added AuthorizationException.isRetriable() method to identify transient errors that should be retried:
    • All 5xx server errors (500, 502, 503, 504, etc.)
    • 400 errors with retry hints ("retry your request", "unknown_error")
    • 429 rate limit errors
  • Updated FormCommand to handle 5xx errors as AuthorizationException instead of IOException for consistent retry handling
  • Modified retry policy in DataCloudTokenProvider to retry retriable AuthorizationExceptions while failing fast on permanent auth errors
  • Added comprehensive retry logging:
    • WARN logs on each retry attempt with attempt number and error details
    • ERROR logs when all retries are exhausted
  • Improved error logging in getWithRetry() to extract and log full error details including HTTP codes and error descriptions

This improves debugging of authentication issues and makes the driver more resilient to transient server-side failures commonly seen in test environments.

@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

❌ Patch coverage is 73.52941% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.23%. Comparing base (b8c5eb9) to head (2866da5).

Files with missing lines Patch % Lines
...ce/datacloud/jdbc/auth/DataCloudTokenProvider.java 67.92% 12 Missing and 5 partials ⚠️
...cloud/jdbc/auth/errors/AuthorizationException.java 74.07% 0 Missing and 7 partials ⚠️
...om/salesforce/datacloud/jdbc/http/FormCommand.java 86.36% 1 Missing and 2 partials ⚠️

❌ Your patch check has failed because the patch coverage (73.52%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #140      +/-   ##
============================================
- Coverage     83.47%   83.23%   -0.25%     
- Complexity     1271     1289      +18     
============================================
  Files           104      105       +1     
  Lines          3765     3859      +94     
  Branches        375      396      +21     
============================================
+ Hits           3143     3212      +69     
- Misses          462      475      +13     
- Partials        160      172      +12     
Components Coverage Δ
JDBC Core 85.55% <ø> (ø)
JDBC Main 40.69% <ø> (ø)
JDBC HTTP 87.60% <73.52%> (-3.50%) ⬇️
JDBC Utilities 60.97% <ø> (ø)
Spark Datasource ∅ <ø> (∅)
Files with missing lines Coverage Δ
...om/salesforce/datacloud/jdbc/http/FormCommand.java 86.88% <86.36%> (-1.49%) ⬇️
...cloud/jdbc/auth/errors/AuthorizationException.java 74.07% <74.07%> (ø)
...ce/datacloud/jdbc/auth/DataCloudTokenProvider.java 81.63% <67.92%> (-6.13%) ⬇️

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Enhanced error logging and retry logic for authentication failures to
provide better visibility into transient server errors and improve
resilience against flaky authentication endpoints.

Changes:
- Enhanced AuthorizationException.getMessage() to include HTTP status
  code and error description in a structured format
- Added AuthorizationException.isRetriable() method to identify
  transient errors that should be retried:
  * All 5xx server errors (500, 502, 503, 504, etc.)
  * 400 errors with retry hints ("retry your request", "unknown_error")
  * 429 rate limit errors
- Updated FormCommand to handle 5xx errors as AuthorizationException
  instead of IOException for consistent retry handling
- Modified retry policy in DataCloudTokenProvider to retry retriable
  AuthorizationExceptions while failing fast on permanent auth errors
- Added comprehensive retry logging:
  * WARN logs on each retry attempt with attempt number and error details
  * ERROR logs when all retries are exhausted
- Improved error logging in getWithRetry() to extract and log full
  error details including HTTP codes and error descriptions

This improves debugging of authentication issues and makes the driver
more resilient to transient server-side failures commonly seen in
test environments.
@KaviarasuSakthivadivel KaviarasuSakthivadivel force-pushed the improve-auth-error-logging-and-retry branch from fa56d30 to 2866da5 Compare December 2, 2025 23:09
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