Skip to content

Commit faa55db

Browse files
committed
get udp exporter address from env var
1 parent 4ba5ae2 commit faa55db

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@
6363
APPLICATION_SIGNALS_EXPORTER_ENDPOINT_CONFIG = "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT"
6464
METRIC_EXPORT_INTERVAL_CONFIG = "OTEL_METRIC_EXPORT_INTERVAL"
6565
DEFAULT_METRIC_EXPORT_INTERVAL = 60000.0
66-
AWS_LAMBDA_FUNCTION_NAME_ENV_VAR = "AWS_LAMBDA_FUNCTION_NAME"
66+
AWS_LAMBDA_FUNCTION_NAME_CONFIG = "AWS_LAMBDA_FUNCTION_NAME"
67+
AWS_XRAY_DAEMON_ADDRESS_CONFIG = "AWS_XRAY_DAEMON_ADDRESS"
6768

6869
_logger: Logger = getLogger(__name__)
6970

@@ -268,7 +269,7 @@ def _is_application_signals_enabled():
268269

269270
def _is_lambda_environment():
270271
# detect if running in AWS Lambda environment
271-
return AWS_LAMBDA_FUNCTION_NAME_ENV_VAR in os.environ
272+
return AWS_LAMBDA_FUNCTION_NAME_CONFIG in os.environ
272273

273274

274275
class ApplicationSignalsExporterProvider:
@@ -300,7 +301,8 @@ def create_exporter(self):
300301

301302
if _is_lambda_environment():
302303
# When running in Lambda, export Application Signals metrics over UDP
303-
return OtlpUdpMetricExporter(endpoint="127.0.0.1:2000", preferred_temporality=temporality_dict)
304+
application_signals_endpoint = os.environ.get(AWS_XRAY_DAEMON_ADDRESS_CONFIG, "127.0.0.1:2000")
305+
return OtlpUdpMetricExporter(endpoint=application_signals_endpoint, preferred_temporality=temporality_dict)
304306

305307
if protocol == "http/protobuf":
306308
application_signals_endpoint = os.environ.get(

0 commit comments

Comments
 (0)