Skip to content

fix(otel): End all recording spans on non-terminal invocations - #650

Open
ayushiahjolia wants to merge 1 commit into
mainfrom
fix/otel-end-spans-non-terminal-v2
Open

fix(otel): End all recording spans on non-terminal invocations#650
ayushiahjolia wants to merge 1 commit into
mainfrom
fix/otel-end-spans-non-terminal-v2

Conversation

@ayushiahjolia

@ayushiahjolia ayushiahjolia commented Aug 24, 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

#624

Description

Ensures no recording span is ever left un-ended on a non-terminal (PENDING/RETRYING) invocation, which previously abandoned open Workflow and operation spans on every suspend.

  • Workflow span (both plugins): No longer created in onInvocationStart. Between invocations it exists only as a deterministic SpanContext (stable trace and span ID) that operation and attempt spans link to. The recording span is started and ended in a single call on the terminal invocation only, parented onto the execution ancestor - so it is never left open.
  • Operation spans (ExecutionOtelPlugin): Deferred. onOperationStart retains only a deterministic context; the span is created once in onOperationEnd (with a start-timestamp fallback for virtual map/parallel operations that report no timestamp at end), so a suspended operation never leaves an open span and a suspended-then-resumed operation still stitches into one logical span. InvocationOtelPlugin continues to create operation spans eagerly but force-ends any still open at invocation end.
  • Attempt spans: Any still open at invocation end are force-ended.

Demo/Screenshots

N/A

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

Integration Tests

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

Examples

Has a new example been added for the change? (if applicable) N/A

@github-actions

This comment has been minimized.

@ayushiahjolia
ayushiahjolia force-pushed the fix/otel-end-spans-non-terminal-v2 branch from 7996423 to 805ee60 Compare August 26, 2026 18:27
@ayushiahjolia
ayushiahjolia temporarily deployed to ai-pr-review-runtime August 26, 2026 18:29 — with GitHub Actions Inactive
@github-actions

This comment has been minimized.

Base automatically changed from feat/otel-backend-parented-topology to main August 26, 2026 18:54
@ayushiahjolia
ayushiahjolia force-pushed the fix/otel-end-spans-non-terminal-v2 branch from 805ee60 to d3d37ee Compare August 26, 2026 18:54
@ayushiahjolia
ayushiahjolia temporarily deployed to ai-pr-review-runtime August 26, 2026 19:21 — with GitHub Actions Inactive
@github-actions

This comment has been minimized.

@ayushiahjolia
ayushiahjolia force-pushed the fix/otel-end-spans-non-terminal-v2 branch from d3d37ee to 285573e Compare August 26, 2026 22:19
@ayushiahjolia
ayushiahjolia force-pushed the fix/otel-end-spans-non-terminal-v2 branch 2 times, most recently from 0af9b13 to af20a34 Compare August 26, 2026 23:40
@ayushiahjolia

Copy link
Copy Markdown
Contributor Author

/ai review

@github-actions

This comment has been minimized.

@ayushiahjolia
ayushiahjolia force-pushed the fix/otel-end-spans-non-terminal-v2 branch from af20a34 to 6372919 Compare August 27, 2026 18:28
@ayushiahjolia

Copy link
Copy Markdown
Contributor Author

/ai review

@ayushiahjolia
ayushiahjolia force-pushed the fix/otel-end-spans-non-terminal-v2 branch from 6372919 to 1b92765 Compare August 27, 2026 18:41
@ayushiahjolia

Copy link
Copy Markdown
Contributor Author

/ai review

@github-actions

This comment has been minimized.

@ayushiahjolia
ayushiahjolia marked this pull request as ready for review August 27, 2026 19:13
@ayushiahjolia
ayushiahjolia requested a review from a team August 27, 2026 19:13
@ayushiahjolia
ayushiahjolia deployed to ai-pr-review-runtime August 27, 2026 19:13 — with GitHub Actions Active
@ayushiahjolia
ayushiahjolia deployed to ai-pr-review-runtime August 27, 2026 19:13 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown
Contributor

Codex AI review

No actionable findings. Residual risk: lifecycle tracking is hook-level; no runner-level test verifies that PENDING/RETRYING executions leave no recording spans open.

Reviewed commit 1b92765dbcbf373801e69fbe875971587eac61d2. Workflow run

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.

1 participant