myps6415 commented on code in PR #67592:
URL: https://github.com/apache/airflow/pull/67592#discussion_r3719241730
##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -297,7 +312,21 @@ def ti_run(
or 0
)
- dr.team_name = get_team_name_for_ti(task_instance_id, session)
+ team_name = get_team_name_for_ti(task_instance_id, session)
+ dr.team_name = team_name
+
+ if emit_queued_duration:
+ # Tag via dr.stats_tags so this stays sliceable the same way as
its sibling
+ # task.scheduled_duration, which emit_state_change_metric sends as
+ # {**ti.stats_tags, "queue": ti.queue} -- that is
dag_run.stats_tags plus task_id.
+ # Team lives on the Bundle rather than the DagRun schema, so
stats_tags cannot resolve
+ # it here; add the value looked up above instead. Falsy values are
pruned from
+ # stats_tags, so only set it when there is a team. The
registry-derived legacy name
+ # dag.<dag_id>.<task_id>.queued_duration is emitted by
stats.timing automatically.
+ tags = {**dr.stats_tags, "task_id": ti.task_id, "queue": ti.queue}
+ if team_name:
+ tags["team_name"] = team_name
Review Comment:
Test added with `conf_vars`, and it fails if the team tag is dropped.
`_team_name`: agreed — left out since it touches the same lines as the axis
decision.
--
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]