-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Airbyte CDK: Log http status code and content in backoff handlers #8829
Merged
augan-rymkhan
merged 4 commits into
master
from
arymkhan/log-http-response-status-and-content
Dec 16, 2021
Merged
Airbyte CDK: Log http status code and content in backoff handlers #8829
augan-rymkhan
merged 4 commits into
master
from
arymkhan/log-http-response-status-and-content
Dec 16, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sergei-solonitcyn
approved these changes
Dec 16, 2021
@@ -21,6 +21,8 @@ | |||
def default_backoff_handler(max_tries: int, factor: int, **kwargs): | |||
def log_retry_attempt(details): | |||
_, exc, _ = sys.exc_info() | |||
if exc.response is not None: | |||
logger.info(f"Status code: {exc.response.status_code}, Response Content: {exc.response.content}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to your following code, you could use just if exc.response:
and it would be clear enough.
Contributor
Author
/publish-cdk dry-run=false
|
schlattk
pushed a commit
to schlattk/airbyte
that referenced
this pull request
Jan 4, 2022
…rbytehq#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 <auganenu@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
https://github.com/airbytehq/airbyte/blob/master/airbyte-cdk/python/airbyte_cdk/sources/streams/http/http.py#L227
When backoff is happened we don't know the response status code and its content (usefull message about why request was rejected from host). We only know it is 429 or 500 <= status code 600
How
Log http response status code and content in
log_retry_attempt
insidedefault_backoff_handler
andin
sleep_on_ratelimit
insideuser_defined_backoff_handler
Recommended reading order
airbyte-cdk/python/airbyte_cdk/sources/streams/http/rate_limiting.py