Add task.execute detail span around task execute callable#67877
Merged
Conversation
kaxil
reviewed
Jun 1, 2026
3d7a891 to
e8eaacf
Compare
1 task
kaxil
reviewed
Jun 30, 2026
kaxil
approved these changes
Jun 30, 2026
kaxil
left a comment
Member
There was a problem hiding this comment.
LGTM -- clean extraction, and the task.execute span now correctly nests the operator's child spans (verified the nesting mechanism end to end). Approving.
Two non-blocking questions left inline: the safeguard-tracker test doesn't assert tracker non-leakage (one extra assertion would pin it), and a confirm-intent note on the copy_context() snapshot now being taken after the pre-execute hooks. Neither gates merge. The timeout span-status follow-up is tracked in #69146.
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.
e8eaacf to
68e21b7
Compare
1 task
1 task
jason810496
added a commit
that referenced
this pull request
Jul 2, 2026
PR #67877 wrapped the operator execute callable in a new task.execute detail span, so operator-emitted spans now nest under it instead of directly under _execute_task. Integration tests do not run on regular PRs, so the expected span hierarchy in the OTel integration test was not updated there and the canary build started failing.
github-actions Bot
pushed a commit
to aws-mwaa/upstream-to-airflow
that referenced
this pull request
Jul 2, 2026
apache#69236) PR apache#67877 wrapped the operator execute callable in a new task.execute detail span, so operator-emitted spans now nest under it instead of directly under _execute_task. Integration tests do not run on regular PRs, so the expected span hierarchy in the OTel integration test was not updated there and the canary build started failing. (cherry picked from commit 55cdf67) Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
jason810496
added a commit
to jason810496/airflow
that referenced
this pull request
Jul 2, 2026
The otel core integration was only triggered by observability sources, so PRs changing the spans the task runner emits (like apache#67877) or the otel integration tests themselves passed CI without running the tests that assert the span hierarchy, and breakage surfaced only in canary builds.
1 task
aws-airflow-bot
pushed a commit
to aws-mwaa/upstream-to-airflow
that referenced
this pull request
Jul 2, 2026
apache#69236) PR apache#67877 wrapped the operator execute callable in a new task.execute detail span, so operator-emitted spans now nest under it instead of directly under _execute_task. Integration tests do not run on regular PRs, so the expected span hierarchy in the OTel integration test was not updated there and the canary build started failing. (cherry picked from commit 55cdf67) Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
vatsrahul1001
pushed a commit
that referenced
this pull request
Jul 3, 2026
… code changes (#69250) The otel core integration was only triggered by observability sources, so PRs changing the spans the task runner emits (like #67877) or the otel integration tests themselves passed CI without running the tests that assert the span hierarchy, and breakage surfaced only in canary builds. (cherry picked from commit 5298431) Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
vatsrahul1001
pushed a commit
that referenced
this pull request
Jul 3, 2026
#69236) PR #67877 wrapped the operator execute callable in a new task.execute detail span, so operator-emitted spans now nest under it instead of directly under _execute_task. Integration tests do not run on regular PRs, so the expected span hierarchy in the OTel integration test was not updated there and the canary build started failing. (cherry picked from commit 55cdf67) Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
1 task
potiuk
added a commit
that referenced
this pull request
Jul 3, 2026
…69359) 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) Co-authored-by: Daniel Standish <15932138+dstandish@users.noreply.github.com>
potiuk
added a commit
that referenced
this pull request
Jul 3, 2026
… code changes (#69250) (#69285) The otel core integration was only triggered by observability sources, so PRs changing the spans the task runner emits (like #67877) or the otel integration tests themselves passed CI without running the tests that assert the span hierarchy, and breakage surfaced only in canary builds. (cherry picked from commit 5298431) Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com> Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extracts the execute-callable invocation (including the execution-timeout wrapper) from
_execute_taskinto a dedicated_run_execute_callablehelper decorated with@detail_span("task.execute"). This emits a child span around the actual task execution when the task span detail level is greater than 1, giving finer-grained tracing of where time is spent within a task run.Regular task failures mark the span as errored automatically via OpenTelemetry.
AirflowTaskTimeoutinherits fromBaseException, which OpenTelemetry does not auto-record, so the timeout handler sets the span status toERRORexplicitly.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.8) following the guidelines