Skip to content

Commit a423019

Browse files
committed
move lambda environment check to otlp constructor
1 parent 368148e commit a423019

File tree

1 file changed

+4
-4
lines changed
  • exporters/aws-otel-otlp-udp-exporter/src/amazon/opentelemetry/exporters/otlp/udp

1 file changed

+4
-4
lines changed

exporters/aws-otel-otlp-udp-exporter/src/amazon/opentelemetry/exporters/otlp/udp/exporter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323

2424
class UdpExporter:
2525
def __init__(self, endpoint: Optional[str] = None):
26-
if endpoint is None and "AWS_LAMBDA_FUNCTION_NAME" in os.environ:
27-
# If in an AWS Lambda Environment, `AWS_XRAY_DAEMON_ADDRESS` will be defined
28-
endpoint = os.environ.get("AWS_XRAY_DAEMON_ADDRESS", DEFAULT_ENDPOINT)
29-
3026
self._endpoint = endpoint or DEFAULT_ENDPOINT
3127
self._host, self._port = self._parse_endpoint(self._endpoint)
3228
self._socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@@ -61,6 +57,10 @@ def _parse_endpoint(self, endpoint: str) -> Tuple[str, int]:
6157

6258
class OTLPUdpSpanExporter(SpanExporter):
6359
def __init__(self, endpoint: Optional[str] = None, sampled: bool = True):
60+
if endpoint is None and "AWS_LAMBDA_FUNCTION_NAME" in os.environ:
61+
# If in an AWS Lambda Environment, `AWS_XRAY_DAEMON_ADDRESS` will be defined
62+
endpoint = os.environ.get("AWS_XRAY_DAEMON_ADDRESS", DEFAULT_ENDPOINT)
63+
6464
self._udp_exporter = UdpExporter(endpoint=endpoint)
6565
self._sampled = sampled
6666

0 commit comments

Comments
 (0)