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

boto3 should provide a way to obtain AWS RequestIds #1143

Closed
thanatos opened this issue Jun 19, 2017 · 4 comments
Closed

boto3 should provide a way to obtain AWS RequestIds #1143

thanatos opened this issue Jun 19, 2017 · 4 comments
Labels
closed-for-staleness feature-request This issue requests a feature. response-requested Waiting on additional information or feedback.

Comments

@thanatos
Copy link

Every time I've filed a bug w/ AWS support, even for the this-is-obviously-trivially-broken-on-your-side bug, they always want a request ID.

AFAICT looking at the code, the only place that boto3 reports the request ID is when the request as a whole gets logged; this is really hard to work with, since the response body is huge.

If the request ID were passed as extra data to the logging call, I could extract it via a custom handler. Or some sort of callback system, etc.

@kyleknap
Copy link
Contributor

So one way to reliably get the request ID is by accessing the RequestMetadata for any client request:

In [1]: import boto3

In [2]: c = boto3.client('ec2')

In [3]: resp = c.describe_regions()

In [4]: resp['ResponseMetadata']
Out[4]: 
{'HTTPHeaders': {'content-type': 'text/xml;charset=UTF-8',
  'date': 'Wed, 21 Jun 2017 16:11:20 GMT',
  'server': 'AmazonEC2',
  'transfer-encoding': 'chunked',
  'vary': 'Accept-Encoding'},
 'HTTPStatusCode': 200,
 'RequestId': '6f86084a-62db-4ecc-ad9d-6592c2f51dd8',
 'RetryAttempts': 0}

and in this request metadata you will have access to the request id for any client calls you make.

However, this not easily accessible through the logs as you pointed out nor through the resource interface, which I think would be useful to have as well. Marking as feature request.

@kyleknap kyleknap added the feature-request This issue requests a feature. label Jun 21, 2017
@dejonghe
Copy link

I had to turn this on today. Try: boto3.set_stream_logger(name='botocore',level=10)

@aBurmeseDev
Copy link
Contributor

Hi @thanatos, I'd recommend to check out this doc on how to log Request IDs and this doc also provides a good example of how to handle error responses. Please let me know if that accomplishes the goal here!

@aBurmeseDev aBurmeseDev added the response-requested Waiting on additional information or feedback. label Jul 16, 2022
@github-actions
Copy link

Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness feature-request This issue requests a feature. response-requested Waiting on additional information or feedback.
Projects
None yet
Development

No branches or pull requests

4 participants