|
16 | 16 |
|
17 | 17 | _logger = logging.getLogger(__name__) |
18 | 18 |
|
| 19 | + |
19 | 20 | class OTLPAwsSigV4Exporter(OTLPSpanExporter): |
20 | 21 |
|
21 | 22 | def __init__( |
@@ -72,24 +73,26 @@ def _export(self, serialized_data: bytes): |
72 | 73 | def _validate_exporter_endpoint(endpoint: str) -> Optional[str]: |
73 | 74 | if not endpoint: |
74 | 75 | return None |
75 | | - |
76 | | - match = re.search(f'{AWS_SERVICE}\.([a-z0-9-]+)\.amazonaws\.com', endpoint) |
77 | | - |
| 76 | + |
| 77 | + match = re.search(f"{AWS_SERVICE}\.([a-z0-9-]+)\.amazonaws\.com", endpoint) |
| 78 | + |
78 | 79 | if match: |
79 | 80 | region = match.group(1) |
80 | 81 | xray_regions = session.Session().get_available_regions(AWS_SERVICE) |
81 | 82 | if region in xray_regions: |
82 | 83 | return region |
83 | | - |
84 | | - _logger.error("Invalid AWS region: %s. Valid regions are %s. Resolving to default endpoint.", |
85 | | - region, xray_regions) |
| 84 | + |
| 85 | + _logger.error( |
| 86 | + "Invalid AWS region: %s. Valid regions are %s. Resolving to default endpoint.", region, xray_regions |
| 87 | + ) |
86 | 88 | return None |
87 | | - |
88 | | - _logger.error("Invalid XRay traces endpoint: %s. Resolving to default endpoint. " |
89 | | - "The traces endpoint follows the pattern https://xray.[AWSRegion].amazonaws.com/v1/traces. " |
90 | | - "For example, for the US West (Oregon) (us-west-2) Region, the endpoint will be " |
91 | | - "https://xray.us-west-2.amazonaws.com/v1/traces.", |
92 | | - endpoint) |
93 | | - |
94 | | - return None |
95 | 89 |
|
| 90 | + _logger.error( |
| 91 | + "Invalid XRay traces endpoint: %s. Resolving to default endpoint. " |
| 92 | + "The traces endpoint follows the pattern https://xray.[AWSRegion].amazonaws.com/v1/traces. " |
| 93 | + "For example, for the US West (Oregon) (us-west-2) Region, the endpoint will be " |
| 94 | + "https://xray.us-west-2.amazonaws.com/v1/traces.", |
| 95 | + endpoint, |
| 96 | + ) |
| 97 | + |
| 98 | + return None |
0 commit comments