ashb commented on code in PR #68568:
URL: https://github.com/apache/airflow/pull/68568#discussion_r3580396907
##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -736,9 +736,19 @@ 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)}
+ run_type = self.dag_run.run_type
+ base = prune_dict(
+ {
+ "dag_id": self.dag_id,
+ "task_id": self.task_id,
+ # bare value so it serializes as e.g. "scheduled", not
"dagruntype.scheduled"
+ "run_type": getattr(run_type, "value", run_type),
+ "team_name": getattr(self, "_team_name", None),
+ }
)
+ dag_tags = self.dag_run.dag_tags_for_stats()
+ # Built-in keys win on collision; dag tags fill in everything else.
+ return {**dag_tags, **base}
Review Comment:
I wonder if this should be
```suggestion
return {**self.dag_run.stats_tags, "task_id", self.task_id}
```
--
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]