@@ -74,28 +74,23 @@ def __init__(
74
74
# the same except if the endpoint is an XRay OTLP endpoint, we will sign the request
75
75
# with SigV4 in headers before sending it to the endpoint. Otherwise, we will skip signing.
76
76
def _export (self , serialized_data : bytes ):
77
+ request = self .boto_aws_request .AWSRequest (
78
+ method = "POST" ,
79
+ url = self ._endpoint ,
80
+ data = serialized_data ,
81
+ headers = {"Content-Type" : "application/x-protobuf" },
82
+ )
77
83
78
- if self ._aws_region :
79
- request = self .boto_aws_request .AWSRequest (
80
- method = "POST" ,
81
- url = self ._endpoint ,
82
- data = serialized_data ,
83
- headers = {"Content-Type" : "application/x-protobuf" },
84
- )
85
-
86
- credentials = self .boto_session .get_credentials ()
87
-
88
- if credentials is not None :
89
- signer = self .boto_auth .SigV4Auth (credentials , AWS_SERVICE , self ._aws_region )
84
+ credentials = self .boto_session .get_credentials ()
90
85
91
- try :
92
- signer .add_auth (request )
93
- self ._session .headers .update (dict (request .headers ))
86
+ if credentials is not None :
87
+ signer = self .boto_auth .SigV4Auth (credentials , AWS_SERVICE , self ._aws_region )
94
88
95
- except Exception as signing_error : # pylint: disable=broad-except
96
- _logger .error ("Failed to sign request: %s" , signing_error )
89
+ try :
90
+ signer .add_auth (request )
91
+ self ._session .headers .update (dict (request .headers ))
97
92
98
- else :
99
- _logger .error ("Failed to get credentials to export span to OTLP CloudWatch endpoint" )
93
+ except Exception as signing_error : # pylint: disable=broad-except
94
+ _logger .error ("Failed to sign request: %s" , signing_error )
100
95
101
96
return super ()._export (serialized_data )
0 commit comments