Skip to content

fix(otel): Fix X-Ray trace integration and cross-invocation retry spans#508

Open
ayushiahjolia wants to merge 1 commit into
mainfrom
fix/otel-plugin-xray-integration
Open

fix(otel): Fix X-Ray trace integration and cross-invocation retry spans#508
ayushiahjolia wants to merge 1 commit into
mainfrom
fix/otel-plugin-xray-integration

Conversation

@ayushiahjolia

@ayushiahjolia ayushiahjolia commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Issue Link, if available

#507

Description

Fixes OTel plugin X-Ray integration: cross-invocation retry span grouping, trace context extraction, and trace map display to match the JS SDK behavior.

  1. Retry attempts grouped under wrong invocation - When a step failed in invocation 1 and retried in invocation 2, both operation spans had the same deterministic span ID, causing trace viewers to merge them.
  2. Durable spans in separate traceSystem.getenv("_X_AMZN_TRACE_ID") returned stale/null values due to JVM env caching, so the plugin fell back to an ARN-derived trace ID disconnected from Lambda's X-Ray segments.
  3. Spans nested inside Lambda function instead of separate node - Missingservice.name resource and SpanKind.SERVER prevented X-Ray from creating a distinct service node for durable execution spans.

Demo/Screenshots

Screenshot 2026-06-30 at 12 33 02 PM

Checklist

  • I have filled out every section of the PR template
  • I have thoroughly tested this change

Testing

Unit Tests

Have unit tests been written for these changes? Yes

Integration Tests

Have integration tests been written for these changes? N/A

Examples

Has a new example been added for the change? (if applicable) Updated existing ones.

@ayushiahjolia ayushiahjolia force-pushed the fix/otel-plugin-xray-integration branch 2 times, most recently from ec15f90 to 9a7cb23 Compare June 30, 2026 20:14
@ayushiahjolia ayushiahjolia force-pushed the fix/otel-plugin-xray-integration branch from 9a7cb23 to 5c269c3 Compare June 30, 2026 20:33
@ayushiahjolia ayushiahjolia marked this pull request as ready for review June 30, 2026 20:46
@ayushiahjolia ayushiahjolia requested a review from a team June 30, 2026 20:46
Comment thread examples/template.yaml
- AdotArch: amd64
Environment:
Variables:
AWS_LAMBDA_EXEC_WRAPPER: /opt/otel-handler

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.

how come we don't need this anymore?

Instant startTimestamp,
Instant endTimestamp) {}
Instant endTimestamp,
boolean isContinuation) {}

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.

nit: we're using isReplay in JS (I think it can still be confusing but replay is a terminology that is more commonly used around durable functions). I can be convinced otherwise

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.

how is this new variable currently being used? I'm not seeing changes in the sdk itself

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.

2 participants