Skip to content

Commit 59e5545

Browse files
authored
chore(client/retry): include error info in logs when retry occurs (#487)
On a request retry, it logs an info message stating that an error was encountered and information about the retry process but it hasn't included any details about the error that is causing the retry. This PR updates the logging to include the status if it is a server error and the http error kind if a transport error occurred. While the last error when retries are exhausted is returned up the call stack, the intermediate errors need not be exactly the same. It is helpful to include some minimum information about what error triggered a retry each time it happens.
1 parent c0e241e commit 59e5545

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/client/retry.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,8 @@ impl RetryableRequest {
421421

422422
let sleep = ctx.backoff();
423423
info!(
424-
"Encountered server error, backing off for {} seconds, retry {} of {}",
424+
"Encountered server error with status {}, backing off for {} seconds, retry {} of {}",
425+
status,
425426
sleep.as_secs_f32(),
426427
ctx.retries,
427428
ctx.max_retries,
@@ -445,7 +446,8 @@ impl RetryableRequest {
445446
}
446447
let sleep = ctx.backoff();
447448
info!(
448-
"Encountered transport error backing off for {} seconds, retry {} of {}: {}",
449+
"Encountered transport error of kind {:?}, backing off for {} seconds, retry {} of {}: {}",
450+
e.kind(),
449451
sleep.as_secs_f32(),
450452
ctx.retries,
451453
ctx.max_retries,

0 commit comments

Comments
 (0)