howardyoo commented on code in PR #40802:
URL: https://github.com/apache/airflow/pull/40802#discussion_r1681589265


##########
airflow/executors/base_executor.py:
##########
@@ -335,6 +376,19 @@ def fail(self, key: TaskInstanceKey, info=None) -> None:
         :param info: Executor information for the task instance
         :param key: Unique key for the task instance
         """
+        trace_id = Trace.get_current_span().get_span_context().trace_id
+        span_id = int(gen_span_id_from_ti_key(key, as_int=True))
+        with Trace.start_span(
+            span_name="fail",
+            component="BaseExecutor",
+            parent_sc=gen_context(trace_id=trace_id, span_id=span_id),
+        ) as span:
+            span.set_attribute("dag_id", key.dag_id)
+            span.set_attribute("run_id", key.run_id)
+            span.set_attribute("task_id", key.task_id)
+            span.set_attribute("try_number", key.try_number - 1)

Review Comment:
   Thanks! I've always wondered.. why it was necessary to subtract the try 
number (since it was always 1 larger!).



-- 
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