Skip to content

fix(otel): Fix span emission for cross-invocation operations and replay#482

Merged
ayushiahjolia merged 1 commit into
mainfrom
fix/otel-plugin-span-emission
Jun 23, 2026
Merged

fix(otel): Fix span emission for cross-invocation operations and replay#482
ayushiahjolia merged 1 commit into
mainfrom
fix/otel-plugin-span-emission

Conversation

@ayushiahjolia

@ayushiahjolia ayushiahjolia commented Jun 19, 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

#435

Description

Fixes OTel plugin span emission to correctly handle replay, cross-invocation operations, and virtual contexts.

Previously -

  • Terminal operations replayed in subsequent invocations re-emitted spans with the same deterministic ID, causing X-Ray to overwrite invocation 1's spans
  • Operations completing between invocations (wait, callback, invoke) had no continuation span showing they completed
  • Suspended attempt spans ended with no status/outcome attribute
  • Virtual contexts (map/parallel iterations) were invisible to the OTel plugin

Now -

  • Skip onOperationStart for terminal replay operations (no more overwrites)
  • Fire onOperationStart for non-terminal STEP/CONTEXT during replay (re-executed operations get a parent span)
  • Create continuation spans with Links for operations that completed between invocations
  • Mark suspended attempts as PENDING instead of bare end
  • Emit spans for virtual contexts (aligned with other SDKs)

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? Yes

Examples

Has a new example been added for the change? (if applicable) Yes

@ayushiahjolia ayushiahjolia force-pushed the fix/otel-plugin-span-emission branch from fde0ca0 to eac52b6 Compare June 19, 2026 23:47
@ayushiahjolia ayushiahjolia marked this pull request as ready for review June 20, 2026 00:02
@ayushiahjolia ayushiahjolia requested a review from a team June 20, 2026 00:02

@zhongkechen zhongkechen 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.

Created a follow-up #493

@ayushiahjolia ayushiahjolia merged commit cc076e4 into main Jun 23, 2026
13 checks passed
@ayushiahjolia ayushiahjolia deleted the fix/otel-plugin-span-emission branch June 23, 2026 23:31
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