ashb commented on code in PR #43941:
URL: https://github.com/apache/airflow/pull/43941#discussion_r2026535682


##########
airflow-core/src/airflow/models/dagrun.py:
##########
@@ -897,6 +922,143 @@ def is_effective_leaf(task):
         leaf_tis = {ti for ti in tis if ti.task_id in leaf_task_ids if 
ti.state != TaskInstanceState.REMOVED}
         return leaf_tis
 
+    def set_dagrun_span_attrs(self, span: Span | EmptySpan):
+        if self._state == DagRunState.FAILED:
+            span.set_attribute("airflow.dag_run.error", True)
+
+        attribute_value_type = Union[
+            str,
+            bool,
+            int,
+            float,
+            Sequence[str],
+            Sequence[bool],
+            Sequence[int],
+            Sequence[float],
+        ]
+
+        # Explicitly set the value type to Union[...] to avoid a mypy error.
+        attributes: dict[str, attribute_value_type] = {
+            "airflow.category": "DAG runs",
+            "airflow.dag_run.dag_id": str(self.dag_id),
+            "airflow.dag_run.logical_date": str(self.logical_date),

Review Comment:
   ```suggestion
               "airflow.dag_run.logical_date": str(self.logical_date) if 
self.logical_date is not None else None ,
   ```



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