Skip to content

[v3-3-test] Add task.execute detail span around task execute callable (#67877)#69359

Merged
potiuk merged 1 commit into
apache:v3-3-testfrom
potiuk:backport-67877-v3-3-test
Jul 3, 2026
Merged

[v3-3-test] Add task.execute detail span around task execute callable (#67877)#69359
potiuk merged 1 commit into
apache:v3-3-testfrom
potiuk:backport-67877-v3-3-test

Conversation

@potiuk

@potiuk potiuk commented Jul 3, 2026

Copy link
Copy Markdown
Member

Backport of #67877 to v3-3-test.

Why

The OTel integration test on v3-3-test (test_dag_execution_succeeds[detail_spans])
expects operator-emitted spans (e.g. sub_span1) to nest under a task.execute span,
but that span was never emitted on v3-3-test: the test-expectation update (#69236,
backported as #69246) landed here without its source dependency #67877, which adds
the @detail_span("task.execute") wrapper around the operator execute callable.

As a result the test deterministically fails (sub_span1 nests under _execute_task
instead of task.execute). This surfaced now because #69285 makes CI actually run the
OTel integration test on v3-3-test.

This backport restores the missing source change so the span hierarchy matches the
already-backported test expectation, unblocking #69285.

Verification

Cherry-picked from b006a97 (auto-merged cleanly; task_runner.py had diverged but
without overlapping edits). Verified locally:

  • _execute_task now calls the new _run_execute_callable (@detail_span("task.execute"));
    contextvars snapshot + ExecutorSafeguard tracker + execution-timeout handling moved into it.
  • ruff clean.
  • test_task_runner.py execute suite passes (12 tests), including
    test_operator_child_spans_nest_under_task_execute.

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines

When task span detail level is greater than 1, the actual execute call was not separately traced, making it hard to see how much of a task's runtime was spent in the operator's own work versus the surrounding setup. Wrapping the execute call in its own span gives that finer-grained breakdown.

The contextvars context the callable runs in is snapshotted inside the new helper, after the span is current, so spans the operator emits during execute nest under it rather than alongside it.

(cherry picked from commit b006a97)
@potiuk potiuk merged commit 6cae1b6 into apache:v3-3-test Jul 3, 2026
92 checks passed
@potiuk potiuk deleted the backport-67877-v3-3-test branch July 3, 2026 19:22
@github-actions github-actions Bot added this to the Airflow 3.3.1 milestone Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.3.1 based on: merged to version branch
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants