Skip to content

Commit 579efb3

Browse files
committed
fix arbitrary url error
1 parent db6d384 commit 579efb3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33
# Modifications Copyright The OpenTelemetry Authors. Licensed under the Apache License 2.0 License.
44
import os
5+
import re
56
from logging import Logger, getLogger
67
from typing import ClassVar, Dict, List, Type, Union
78

@@ -450,13 +451,9 @@ def _is_otlp_endpoint_cloudwatch():
450451
otlp_endpoint = os.environ.get(OTEL_EXPORTER_OTLP_TRACES_ENDPOINT)
451452
if not otlp_endpoint:
452453
return False
454+
pattern = r"xray\.([a-z0-9-]+)\.amazonaws\.com"
453455

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
456+
return bool(re.match(pattern, otlp_endpoint.lower()))
460457

461458

462459
def _get_metric_export_interval():

0 commit comments

Comments
 (0)