Skip to content

Commit 5fc6cfb

Browse files
committed
fixing sanitation issue
1 parent a34e899 commit 5fc6cfb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,17 @@ def _is_lambda_environment():
446446

447447

448448
def _is_otlp_endpoint_cloudwatch():
449+
# Detects if it's the OTLP endpoint in CloudWatchs
449450
otlp_endpoint = os.environ.get(OTEL_EXPORTER_OTLP_TRACES_ENDPOINT)
450-
return otlp_endpoint and "xray." in otlp_endpoint.lower() and ".amazonaws.com" in otlp_endpoint.lower()
451+
if not otlp_endpoint:
452+
return False
453+
454+
endpoint_lower = otlp_endpoint.lower()
455+
456+
has_xray = "xray." in endpoint_lower
457+
has_amazonaws = ".amazonaws.com" in endpoint_lower
458+
459+
return has_xray and has_amazonaws
451460

452461

453462
def _get_metric_export_interval():

0 commit comments

Comments
 (0)