Skip to content

Commit 8ed04ef

Browse files
feat: include error message in rate limit and backoff log lines
Co-Authored-By: alexandre@airbyte.io <alexandre@airbyte.io>
1 parent 8f0b997 commit 8ed04ef

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

airbyte_cdk/sources/streams/http/http_client.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,16 @@ def _handle_error_resolution(
441441
# Emit stream status RUNNING with the reason RATE_LIMITED to log that the rate limit has been reached
442442
if error_resolution.response_action == ResponseAction.RATE_LIMITED:
443443
self._logger.info(
444-
"Rate limited: emitting RATE_LIMITED stream status for stream '%s' (status code: %s, url: %s)",
444+
"Rate limited: emitting RATE_LIMITED stream status for stream '%s' (status code: %s, url: %s, error: %s)",
445445
self._name,
446446
response.status_code if response is not None else "N/A",
447447
request.url,
448+
error_resolution.error_message
449+
or (
450+
self._error_message_parser.parse_response_error_message(response)
451+
if response is not None
452+
else str(exc)
453+
),
448454
)
449455
# TODO: Update to handle with message repository when concurrent message repository is ready
450456
reasons = [AirbyteStreamStatusReason(type=AirbyteStreamStatusReasonType.RATE_LIMITED)]
@@ -532,12 +538,18 @@ def _handle_error_resolution(
532538
break
533539
if user_defined_backoff_time is not None:
534540
self._logger.info(
535-
"Rate limit backoff: waiting %.2f seconds before retry (attempt %d, status code: %s, action: %s, url: %s)",
541+
"Retrying with backoff: waiting %.2f seconds (attempt %d, status code: %s, action: %s, url: %s, error: %s)",
536542
user_defined_backoff_time,
537543
self._request_attempt_count[request],
538544
response.status_code if response is not None else "N/A",
539545
error_resolution.response_action.value,
540546
request.url,
547+
error_resolution.error_message
548+
or (
549+
self._error_message_parser.parse_response_error_message(response)
550+
if response is not None
551+
else str(exc)
552+
),
541553
)
542554
error_message = (
543555
error_resolution.error_message

0 commit comments

Comments
 (0)