Skip to content

[Bug]: Align Execution view log correlation with Workflow and operation spans #893

Open

Description

@zhongkechen

Expected Behavior

With the Execution view's built-in log enrichment enabled, durable log records should identify their logical workflow or operation:

Log location Expected spanId
Top-level handler, including before a durable wait and after resume Workflow span
Step body, including successive retry attempts Step operation span
Child-context body Child operation span
Step body inside a child context That step's operation span

Keep the existing Invocation view behavior. This is a log-correlation change: retain attempt spans, active tracing scopes, and span parentage. Workflow should continue to be exported once at terminal completion; log correlation can use its stable identity before it is exported.

Actual Behavior

The Execution plugin explicitly excludes the enclosing Workflow context when resolving a log's span and falls back to Invocation. Step bodies make the attempt span current, so their log records identify the attempt. Child-context bodies already use the child operation span.

  • get_current_span_context() implements the Workflow exclusion and Invocation fallback.
  • on_user_function_start() activates an attempt for a step body and an operation context for a child body.
  • The inspected checkout also has dedicated tests named test_top_level_log_names_invocation_span_not_the_attached_workflow_span and test_step_attempt_log_names_the_attempt_span; their expectations and the README need to be updated with the behavior.

Steps to Reproduce

This report is based on source and existing-test inspection. The following full execution validation recipe has not been run for this report.

  1. Enable the Execution plugin and its built-in log enrichment, and capture the logger's correlation fields plus exported spans.
  2. Emit a durable log at the top level before any operations.
  3. Run a named step that logs from its body, and a named child context that logs from its body and a nested step.
  4. Perform a durable wait that suspends the invocation, then emit another top-level log after resume.
  5. Compare each record's spanId with the corresponding Workflow, Step operation, Child operation, and Attempt spans.
  6. Add a retrying step to check that records from different attempts use the same Step operation spanId.

SDK Version

aws-durable-execution-sdk-python-otel, public main inspected at 4625d01bbfa97da67050014851af7eb41c61a842.

Python Version

Not applicable to source inspection; no Python runtime reproduction was run for this report.

Is this a regression?

Unknown; no last working version has been established.

Acceptance Criteria

  • Top-level logs before suspension and after resume carry the same Workflow spanId, including when a compatible Lambda span was already active.
  • Step-body logs carry the corresponding Step operation spanId across retries; a nested step uses its own operation span.
  • Child-body logs retain the Child operation spanId; leaving a nested scope restores the enclosing logical scope.
  • Replay suppresses duplicate durable logs from completed work.
  • Attempt spans and tracing topology remain intact, and Workflow is exported once at terminal completion.
  • Add regression coverage through the SDK's durable logger and real handler execution path, including concurrent-invocation isolation, enrichment disabled, and the Invocation view as a control.
  • Update the Execution-view log-correlation documentation and any tests that assert the previous mapping.

Related Issues

Activity

  1. zhongkechen commented on Nov 2, 2026

    @zhongkechen
    ContributorAuthor

    Severity - low

    When it triggers. Built-in log enrichment is enabled for the Execution view. Top-level handler logs resolve to the Invocation span, and step-body logs resolve to the active Attempt span, including across resumes and step retries.

    Impact. Logs do not carry the requested stable Workflow or Step-operation spanId, so queries grouped directly by those logical span IDs do not gather the corresponding records. They still identify the active Invocation or Attempt on the trace; this report does not show missing logs, missing spans, or fabricated span IDs. Child-context body correlation already uses the child operation. The Invocation view is outside this requested change.

    Why this severity. This changes an explicit, tested correlation policy to make logical-workflow and logical-step investigation easier. The current mapping is less useful for that grouping but retains meaningful correlation, and the issue does not establish a wrong execution result, replay failure, or lost telemetry. That is a narrower impact than the missing spans and replay-contract errors in the medium-severity examples.

    Source reviewed: current correlation policy and the issue's existing-test findings. The full handler/resume/retry validation recipe has not been run for this triage.

  2. added
    projectThe issues with an ongoing project
    and removed on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpkg:otelPackage: aws-durable-execution-sdk-python-otelprojectThe issues with an ongoing project

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions