|
90 | 90 | OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT" |
91 | 91 | OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT" |
92 | 92 |
|
93 | | -AWS_TRACES_OTLP_ENDPOINT_PATTERN = r"^https://xray\\.([a-z0-9-]+)\\.amazonaws\\.com/v1/traces$" |
94 | | -AWS_LOGS_OTLP_ENDPOINT_PATTERN = r"^https://logs\\.([a-z0-9-]+)\\.amazonaws\\.com/v1/logs$" |
| 93 | +AWS_TRACES_OTLP_ENDPOINT_PATTERN = r"https://xray\.([a-z0-9-]+)\.amazonaws\.com/v1/traces$" |
| 94 | +AWS_LOGS_OTLP_ENDPOINT_PATTERN = r"https://logs\.([a-z0-9-]+)\.amazonaws\.com/v1/logs$" |
95 | 95 |
|
96 | 96 | # UDP package size is not larger than 64KB |
97 | 97 | LAMBDA_SPAN_EXPORT_BATCH_SIZE = 10 |
@@ -177,7 +177,7 @@ def _init_logging( |
177 | 177 | set_logger_provider(provider) |
178 | 178 |
|
179 | 179 | for _, exporter_class in exporters.items(): |
180 | | - exporter_args = {} |
| 180 | + exporter_args: Dict[str, any] = {} |
181 | 181 | log_exporter = _customize_logs_exporter(exporter_class(**exporter_args), resource) |
182 | 182 | provider.add_log_record_processor(BatchLogRecordProcessor(exporter=log_exporter)) |
183 | 183 |
|
@@ -496,16 +496,12 @@ def _is_lambda_environment(): |
496 | 496 | def is_aws_otlp_endpoint(otlp_endpoint: str = None, service: str = "xray") -> bool: |
497 | 497 | """Is the given endpoint an AWS OTLP endpoint?""" |
498 | 498 |
|
| 499 | + pattern = AWS_TRACES_OTLP_ENDPOINT_PATTERN if service == "xray" else AWS_LOGS_OTLP_ENDPOINT_PATTERN |
| 500 | + |
499 | 501 | if not otlp_endpoint: |
500 | 502 | return False |
501 | 503 |
|
502 | | - if service == "xray": |
503 | | - return bool(re.match(AWS_TRACES_OTLP_ENDPOINT_PATTERN, otlp_endpoint.lower())) |
504 | | - |
505 | | - if service == "logs": |
506 | | - return bool(re.match(AWS_LOGS_OTLP_ENDPOINT_PATTERN, otlp_endpoint.lower())) |
507 | | - |
508 | | - return False |
| 504 | + return bool(re.match(pattern, otlp_endpoint.lower())) |
509 | 505 |
|
510 | 506 |
|
511 | 507 | def _get_metric_export_interval(): |
|
0 commit comments