From 35826073902a6b4b12d36eb7e2854d32aa6b29b0 Mon Sep 17 00:00:00 2001 From: Mahad Janjua <134644284+majanjua-amzn@users.noreply.github.com> Date: Wed, 15 May 2024 09:43:18 -0700 Subject: [PATCH] [Lambda] Fix logging to only happen inside lambda function --- aws_xray_sdk/core/lambda_launcher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws_xray_sdk/core/lambda_launcher.py b/aws_xray_sdk/core/lambda_launcher.py index 55d782b4..ef6f8986 100644 --- a/aws_xray_sdk/core/lambda_launcher.py +++ b/aws_xray_sdk/core/lambda_launcher.py @@ -72,7 +72,7 @@ def put_subsegment(self, subsegment): current_entity = self.get_trace_entity() if not self._is_subsegment(current_entity) and (getattr(current_entity, 'initializing', None) or isinstance(current_entity, DummySegment)): - if global_sdk_config.sdk_enabled(): + if global_sdk_config.sdk_enabled() and not os.getenv(LAMBDA_TRACE_HEADER_KEY): log.warning("Subsegment %s discarded due to Lambda worker still initializing" % subsegment.name) return