Skip to content

fix(otel): align operation status spans - #604

Merged
SilanHe merged 1 commit into
mainfrom
codex/fix-otel-operation-status
Jul 31, 2026
Merged

fix(otel): align operation status spans#604
SilanHe merged 1 commit into
mainfrom
codex/fix-otel-operation-status

Conversation

@zhongkechen

Copy link
Copy Markdown
Contributor

Summary

  • emit terminal durable.operation.status for completed CONTEXT spans
  • omit durable.operation.status from STEP attempt spans while preserving durable.attempt.outcome
  • apply the canonical semantics to both OTel plugins with success and failure coverage

Testing

  • hatch run test:all (3078 passed, 2 skipped)
  • hatch run types:check
  • hatch fmt --check in the OTel package

Coordination

Aligns Python with the Java/JS status model tracked by aws/aws-durable-execution-conformance-tests#52 and the updated conformance requirements in aws/aws-durable-execution-conformance-tests#53.

Set completed CONTEXT span operation status from the user-function
outcome in both OTel plugins.

Omit durable.operation.status from STEP attempt spans while retaining
terminal status on logical STEP operation spans.

Cover successful and failed contexts and attempt attributes.
@zhongkechen
zhongkechen force-pushed the codex/fix-otel-operation-status branch from 57d5d45 to 4f54996 Compare July 31, 2026 00:42
@SilanHe
SilanHe self-requested a review July 31, 2026 16:59
@zhongkechen
zhongkechen marked this pull request as ready for review July 31, 2026 21:15
@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime July 31, 2026 21:15 — with GitHub Actions Inactive
@zhongkechen
zhongkechen had a problem deploying to ai-pr-review-runtime July 31, 2026 21:15 — with GitHub Actions Failure
@zhongkechen zhongkechen self-assigned this Jul 31, 2026
@github-actions

Copy link
Copy Markdown

Codex AI review

  • [P2] Preserve one-shot terminal hooks during replaypackages/aws-durable-execution-sdk-python/src/aws_durable_execution_sdk_python/operation/child.py:187: every ReplayChildren replay now emits another on_operation_end for an already-terminal context, contradicting the plugin contract and potentially double-counting metrics or side effects. Finalize replayed OTel spans through a replay-specific hook instead.

  • [P2] Serialize synthetic end-hook deliverypackages/aws-durable-execution-sdk-python/src/aws_durable_execution_sdk_python/plugin.py:450: sync=True invokes plugins directly and concurrently from flat map/parallel branch threads. This breaks the prior callback threading contract and can race non-thread-safe plugins. Dispatch through the single plugin executor and wait for completion to preserve ordering.

  • [P2] Derive context span outcome from terminal statuspackages/aws-durable-execution-sdk-python-otel/src/aws_durable_execution_sdk_python_otel/execution_plugin.py:478, packages/aws-durable-execution-sdk-python-otel/src/aws_durable_execution_sdk_python_otel/invocation_plugin.py:571: context outcomes are now ignored entirely until on_operation_end, whose existing logic marks spans OK whenever error is absent. Because OperationEndInfo.error is optional, FAILED contexts without an error payload are exported as successful. Map span status from info.status and treat a missing failure payload as an unknown error.

Reviewed commit 4f5499654082855c06d78573662a34b27984b147. Workflow run

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

We'll have to port the span status changes in this PR to JS and Java:

Span Python #604 JS (merged) Java (#572)
Attempt span (STEP attempt) success → OK, failure → ERROR + recordException (explicit OK on success) failure → ERROR + recordException; success → UNSET (no OK) failure → ERROR + recordException; success → UNSET (no OK)
Operation / CONTEXT span (at op end) success → OK, failure → ERROR failure → ERROR + recordException; success → UNSET failure → ERROR + recordException; success → UNSET
Continuation span OK / ERROR ERROR only (UNSET on success) ERROR only (UNSET on success)

@SilanHe

SilanHe commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

I can get started on them once this is merged

@SilanHe
SilanHe merged commit 4d4b744 into main Jul 31, 2026
25 of 30 checks passed
@SilanHe
SilanHe deleted the codex/fix-otel-operation-status branch July 31, 2026 22:15
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