Skip to content

Prefer Lambda X-Ray trace header from carrier - #3083

Open
akg268 wants to merge 1 commit into
open-telemetry:mainfrom
akg268:aws-lambda-xray-context
Open

Prefer Lambda X-Ray trace header from carrier#3083
akg268 wants to merge 1 commit into
open-telemetry:mainfrom
akg268:aws-lambda-xray-context

Conversation

@akg268

@akg268 akg268 commented Aug 30, 2026

Copy link
Copy Markdown

Fixes open-telemetry/opentelemetry-java-instrumentation#15517

This updates the AWS X-Ray Lambda propagator to prefer the Lambda trace header from the extraction carrier under com.amazonaws.xray.traceHeader before falling back to the system property and _X_AMZN_TRACE_ID.

It preserves the existing regular X-Ray propagator behavior and keeps the Lambda-only active tracing path scoped to the Lambda propagator.

Validation: previous CI on the same code path was green; this replacement PR uses the same branch contents after the branch rename.

@akg268

akg268 commented Aug 30, 2026

Copy link
Copy Markdown
Author

Hi @srprash @wangzlei, I opened this replacement PR from a clean branch name. It carries the same Lambda X-Ray propagator update as the earlier green PR and pairs with open-telemetry/opentelemetry-java-instrumentation#19920.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the AWS X-Ray Lambda propagator to first look for the Lambda trace header in the extraction carrier under com.amazonaws.xray.traceHeader (including a lowercase variant) before falling back to the system property and _X_AMZN_TRACE_ID. This keeps the active-tracing Lambda-specific behavior isolated to AwsXrayLambdaPropagator while leaving the regular AwsXrayPropagator unchanged.

Changes:

  • Prefer carrier-provided com.amazonaws.xray.traceHeader during extraction, falling back to system property and environment variable.
  • Support lowercase carrier key lookup (com.amazonaws.xray.traceheader) to match common header normalization behavior.
  • Add unit tests covering precedence, lowercase lookup, and link behavior when both the standard X-Ray header and Lambda trace header are present.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
aws-xray-propagator/src/main/java/io/opentelemetry/contrib/awsxray/propagator/AwsXrayLambdaPropagator.java Adds carrier-first lookup (plus lowercase fallback) before reading system property / env var.
aws-xray-propagator/src/test/java/io/opentelemetry/contrib/awsxray/propagator/AwsXrayLambdaPropagatorTest.java Adds tests verifying new precedence behavior, lowercase carrier key support, and link/parent interactions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Lambda Trace Context Propagation Priority to Use New Lambda Context API

2 participants