Skip to content

Commit 930d98c

Browse files
NathanielRNanuraaga
andcommitted
Update python/src/otel/otel_sdk/opentelemetry/instrumentation/aws_lambda/__init__.py
Co-authored-by: Anuraag Agrawal <[email protected]>
1 parent 6461cf0 commit 930d98c

File tree

1 file changed

+6
-3
lines changed
  • python/src/otel/otel_sdk/opentelemetry/instrumentation/aws_lambda

1 file changed

+6
-3
lines changed

python/src/otel/otel_sdk/opentelemetry/instrumentation/aws_lambda/__init__.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ def _instrument(self, **kwargs):
8686
**kwargs: Optional arguments
8787
``tracer_provider``: a TracerProvider, defaults to global
8888
``event_context_extractor``: a method which takes the Lambda
89-
Event as input and extracts an OTel Context from it. Usually
90-
the the context is extract from HTTP headers on the event.
89+
Event as input and extracts an OTel Context from it. By default,
90+
the context is extracted from the HTTP headers of an API Gateway
91+
request.
9192
"""
9293
tracer = get_tracer(
9394
__name__, __version__, kwargs.get("tracer_provider")
@@ -134,7 +135,9 @@ def _default_event_context_extractor(lambda_event: Any) -> Context:
134135
try:
135136
headers = lambda_event["headers"]
136137
except (TypeError, KeyError):
137-
logger.warning("Failed to extract context from Lambda Event.")
138+
logger.debug(
139+
"Extracting context from Lambda Event failed: either enable X-Ray active tracing or configure API Gateway to trigger this Lambda function as a pure proxy. Otherwise, generated spans will have an invalid (empty) parent context."
140+
)
138141
headers = {}
139142
return get_global_textmap().extract(headers)
140143

0 commit comments

Comments
 (0)