kaxil commented on code in PR #69146:
URL: https://github.com/apache/airflow/pull/69146#discussion_r3498392856


##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -2333,6 +2350,15 @@ def main():
             ):
                 state, _, error = run(ti, context, log)
                 context["exception"] = error
+                # run() funnels every failure path into `error` rather than
+                # re-raising, so the worker span never sees the exception via
+                # propagation. Mark it here, where the worker span is in scope
+                # regardless of trace detail level.
+                if error is not None:
+                    span.record_exception(error)
+                    span.set_status(

Review Comment:
   Marking the worker span here (in scope regardless of detail level) cleanly 
fixes the level-1 case from #67877 -- the worker span is now ERROR for every 
failure uniformly. One residual at detail level >1: the inner `task.execute` / 
`_execute_task` detail spans still close UNSET on a *timeout* specifically. 
`AirflowTaskTimeout` is a `BaseException`, so OTel's `use_span` won't auto-tag 
them (it gates on `Exception`), and they've already closed by the time `main()` 
stamps the worker span here. Regular exceptions do tag the inner spans via 
`use_span`, so there's a timeout-vs-exception asymmetry on the inner spans. Is 
worker-level stamping intended as sufficient, or worth also handling 
`BaseException` at the inner-span level?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to