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


##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -757,9 +756,13 @@ def __hash__(self):
     @property
     def stats_tags(self) -> dict[str, str]:
         """Returns task instance tags."""
-        return prune_dict(
-            {"dag_id": self.dag_id, "task_id": self.task_id, "team_name": 
getattr(self, "_team_name", None)}
-        )
+        # Reuse the dag run's tags (dag_id, run_type, dag tags) and add the 
task-level ones.
+        # team_name is a transient attribute resolved per-object at scheduling 
time, so it may be set
+        # on the TI even when the dag run has not seen it — carry the TI's own 
value when present.
+        tags = {**self.dag_run.stats_tags, "task_id": self.task_id}
+        if team_name := getattr(self, "_team_name", None):

Review Comment:
   This seems odd - i thought team name was a property of the dag, and you 
can't have tasks from multiple teams in one dag



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