Skip to content

Commit ec54ccf

Browse files
grubberrrobbinhan
authored andcommitted
CDK: Evaluate response.text only in debug mode (airbytehq#16809)
Signed-off-by: Sergey Chvalyuk <[email protected]>
1 parent e2c4107 commit ec54ccf

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
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.88
4+
- Bugfix: Evaluate `response.text` only in debug mode
5+
36
## 0.1.87
47
- During incremental syncs allow for streams to emit state messages in the per-stream format
58

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,13 @@ def _send(self, request: requests.PreparedRequest, request_kwargs: Mapping[str,
290290
"Making outbound API request", extra={"headers": request.headers, "url": request.url, "request_body": request.body}
291291
)
292292
response: requests.Response = self._session.send(request, **request_kwargs)
293-
self.logger.debug("Receiving response", extra={"headers": response.headers, "status": response.status_code, "body": response.text})
293+
294+
# Evaluation of response.text can be heavy, for example, if streaming a large response
295+
# Do it only in debug mode
296+
if self.logger.isEnabledFor(logging.DEBUG):
297+
self.logger.debug(
298+
"Receiving response", extra={"headers": response.headers, "status": response.status_code, "body": response.text}
299+
)
294300
if self.should_retry(response):
295301
custom_backoff_time = self.backoff_time(response)
296302
if custom_backoff_time:

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.87",
18+
version="0.1.88",
1919
description="A framework for writing Airbyte Connectors.",
2020
long_description=README,
2121
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)