Skip to content

Commit 6cf44bd

Browse files
committed
removed validation for aws region
1 parent 5aa970e commit 6cf44bd

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/otlp_aws_span_exporter.py

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,28 +74,23 @@ def __init__(
7474
# the same except if the endpoint is an XRay OTLP endpoint, we will sign the request
7575
# with SigV4 in headers before sending it to the endpoint. Otherwise, we will skip signing.
7676
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+
)
7783

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()
9085

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)
9488

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))
9792

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)
10095

10196
return super()._export(serialized_data)

0 commit comments

Comments
 (0)