@@ -34,11 +34,12 @@ def __init__(
3434 rsession : Optional [requests .Session ] = None ,
3535 ):
3636
37- # Represents the region of the CloudWatch OTLP endpoint to send the traces to.
38- # If the endpoint has been verified to be valid, this should not be None
39-
4037 self ._aws_region = None
4138
39+ # Requires botocore to be installed to sign the headers. However,
40+ # some users might not need to use this exporter. In order not conflict
41+ # with existing behavior, we check for botocore before initializing this exporter.
42+
4243 if endpoint and is_xray_otlp_endpoint (endpoint ):
4344
4445 if is_installed ("botocore" ):
@@ -67,7 +68,11 @@ def __init__(
6768 session = rsession ,
6869 )
6970
71+ # Overrides upstream's private implementation of _export. All behaviors are
72+ # the same except if the endpoint is an XRay OTLP endpoint, we will sign the request
73+ # with SigV4 in headers before sending it to the endpoint. Otherwise, we will skip signing.
7074 def _export (self , serialized_data : bytes ):
75+
7176 if self ._aws_region :
7277 request = self .boto_aws_request .AWSRequest (
7378 method = "POST" ,
@@ -85,7 +90,7 @@ def _export(self, serialized_data: bytes):
8590 signer .add_auth (request )
8691 self ._session .headers .update (dict (request .headers ))
8792
88- except self . boto_auth . NoCredentialsError as signing_error :
93+ except Exception as signing_error : # pylint: disable=broad-except
8994 _logger .error ("Failed to sign request: %s" , signing_error )
9095
9196 else :
0 commit comments