Skip to content
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

Add retry information to ResponseMetadata #1024

Merged
merged 5 commits into from
Sep 1, 2016

Conversation

jamesls
Copy link
Member

@jamesls jamesls commented Aug 31, 2016

This pulls in #965 with the following changes:

  • Replace Retries list with the number of retry attempts.
  • Update ClientError messages to include retry information when max attempts are reached.

More context here.

A few examples:

Client error messages:

An error occurred (NotFound) when calling the DescribeInstances operation (max_retries=4 reached): The instance ID 'i-1234' does not exist

ResponseMetadata on error:

 'ResponseMetadata': {'HTTPHeaders': {'connection': 'close',
                                      'date': 'Wed, 31 Aug 2016 17:41:51 GMT',
                                      'server': 'AmazonEC2',
                                      'transfer-encoding': 'chunked'},
                      'HTTPStatusCode': 400,
                      'MaxAttemptsReached': True,
                      'RequestId': 'abcd',
                      'RetryAttempts': 4}}

ResponseMetadata on success:

 'ResponseMetadata': {'HTTPHeaders': {'content-type': 'text/xml;charset=UTF-8',
                                      'date': 'Wed, 31 Aug 2016 17:42:19 GMT',
                                      'server': 'AmazonEC2',
                                      'transfer-encoding': 'chunked',
                                      'vary': 'Accept-Encoding'},
                      'HTTPStatusCode': 200,
                      'RequestId': '25587b14-963b-4357-bc13-56c0acd52d0e',
                      'RetryAttempts': 0}}

cc @kyleknap @JordonPhillips

jantman and others added 4 commits August 31, 2016 10:47
Error messages from ClientErrors will now look like:

An error occurred (C) when calling the O operation (max_retry=4 reached): M

If the error response does not have retry information the client error
is unchanged.
@codecov-io
Copy link

codecov-io commented Aug 31, 2016

Current coverage is 97.57% (diff: 100%)

Merging #1024 into develop will increase coverage by <.01%

@@            develop      #1024   diff @@
==========================================
  Files            44         44          
  Lines          6867       6884    +17   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           6700       6717    +17   
  Misses          167        167          
  Partials          0          0          

Powered by Codecov. Last update 9054a62...c36b7f1

@@ -342,17 +342,30 @@ class UnsupportedSignatureVersionError(BotoCoreError):
class ClientError(Exception):
MSG_TEMPLATE = (
'An error occurred ({error_code}) when calling the {operation_name} '
'operation: {error_message}')
'operation{retry_info}: {error_message}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort of unfortunate that retry_info has to remember to put spaces, but I do not think there is any way around it if we want to put it right between operation and the colon.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. The first version I had rendered the msg, but before calling super() would mess with the msg to inject retry info. This approach seemed less worse that the first approach.

Also open to other ways to improve this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I am fine with how it is now. I cannot think of any other ways.

@kyleknap
Copy link
Contributor

Looks good. Just had small questions and comments.

@jamesls
Copy link
Member Author

jamesls commented Aug 31, 2016

@kyleknap updated.

@kyleknap
Copy link
Contributor

Thanks! 🚢 assuming the tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants