Skip to content

Add RequestId to botocore spans #1524

@tdriscoll

Description

@tdriscoll

Is your feature request related to a problem? Please describe.

When opening an issue with AWS Support, they will ask for the Request ID. If you don't have this ID then they won't help you. You are out of luck if you can't reproduce the issue.

Describe the solution you'd like
I would like to add the RequestID somewhere on the span for the boto3 calls. I couldn't find somewhere obvious to put it in the Elastic Common Schema (it doesn't matter to me where its stored on the span). I am mostly interested in getting this ID for errors but it seems simple enough to add it for errors and successful calls. Something like this (from your botocore.py):

from botocore.exceptions import ClientError def call(self, module, method, wrapped, instance, args, kwargs): ... with capture_span( handler_info.signature, span_type=handler_info.span_type, leaf=True, span_subtype=handler_info.span_subtype, span_action=handler_info.span_action, extra=handler_info.context, ) as span: if service in span_modifiers: span_modifiers[service](span, args, kwargs) try: response = wrapped(*args, **kwargs) add_response_meta_data(span, response) return response except ClientError as client_error: add_response_meta_data(span, client_error.response) raise def add_response_meta_data(span, response): if response: request_id = response.get('ResponseMetadata', {}).get('RequestId') span.label(RequestId = request_id) 

I can submit a PR and tests if that helps.

Describe alternatives you've considered
Its possible to get the request ID if you add very verbose logging (as described here: boto/boto3#1143) but that creates a lot of noise in the logs.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions