Skip to content

Commit 7fbdfc6

Browse files
Airbyte CDK: Log http status code and content in backoff handlers (#8829)
* Log http status code and content in default backoff handler * Log http status code and content in usef defined backoff handler * updated cdk version and changelog * make it clear: exc.response Co-authored-by: auganbay <[email protected]>
1 parent 5ac9049 commit 7fbdfc6

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

airbyte-cdk/python/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 0.1.44
4+
Log http response status code and its content.
5+
36
## 0.1.43
47
Fix logging of unhandled exceptions: print stacktrace.
58

airbyte-cdk/python/airbyte_cdk/sources/streams/http/rate_limiting.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
def default_backoff_handler(max_tries: int, factor: int, **kwargs):
2222
def log_retry_attempt(details):
2323
_, exc, _ = sys.exc_info()
24+
if exc.response:
25+
logger.info(f"Status code: {exc.response.status_code}, Response Content: {exc.response.content}")
2426
logger.info(
2527
f"Caught retryable error '{str(exc)}' after {details['tries']} tries. Waiting {details['wait']} seconds then retrying..."
2628
)
@@ -48,6 +50,8 @@ def user_defined_backoff_handler(max_tries: int, **kwargs):
4850
def sleep_on_ratelimit(details):
4951
_, exc, _ = sys.exc_info()
5052
if isinstance(exc, UserDefinedBackoffException):
53+
if exc.response:
54+
logger.info(f"Status code: {exc.response.status_code}, Response Content: {exc.response.content}")
5155
retry_after = exc.backoff
5256
logger.info(f"Retrying. Sleeping for {retry_after} seconds")
5357
time.sleep(retry_after + 1) # extra second to cover any fractions of second

airbyte-cdk/python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
setup(
1717
name="airbyte-cdk",
18-
version="0.1.43",
18+
version="0.1.44",
1919
description="A framework for writing Airbyte Connectors.",
2020
long_description=README,
2121
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)