-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Is your feature request related to a problem? Please describe.
In traditional AWS Lambda functions, trace context propagation relies on extracting context from environment variables or system properties.
With the introduction of AWS Lambda Managed Instance, a single runtime instance may process multiple requests rather than just one. To support correct context propagation in this model, AWS Lambda has added a new Lambda API (available in updated Lambda runtime versions) that allows functions to retrieve the upstream trace context directly from the Lambda context.
To ensure accurate and reliable trace propagation across requests, the Lambda instrumentation needs to update its propagation logic.
Describe the solution you'd like
Update the context propagation priority in the AWS Lambda instrumentation as follows:
- Use the new Lambda context API, if available, to extract the upstream trace context
- Fallback to system properties, if present
- Finally fallback to environment variables, as the last resort
This ensures correct context propagation for both traditional single-invoke runtimes and the new Managed Instance model.
Technical details
The new API is introduced in
aws/aws-lambda-java-libs#563
Bump dependency for the new API:
library("com.amazonaws:aws-lambda-java-core:1.4.0")
API:
String com.amazonaws.services.lambda.runtime.Context.getTraceHeader()
Refer to OpenTelemetry .Net open-telemetry/opentelemetry-dotnet-contrib#3410, AWS Lambda .Net has only .Net 8 one runtime version, it does not have to fallback to the environment variable.
Describe alternatives you've considered
No response
Additional context
No response
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.