YoannAbriel opened a new pull request, #63522:
URL: https://github.com/apache/airflow/pull/63522
In Airflow 3, tasks transition from QUEUED to RUNNING via the execution API
(`ti_run` endpoint), not the legacy `TaskInstance._run_raw_task` path. The
`task.queued_duration` metric (`dag.{dag_id}.{task_id}.queued_duration` in
legacy format) is only emitted in the old path via
`emit_state_change_metric()`, so it's never recorded for tasks started through
the task SDK.
This adds the metric emission to `ti_run()` — selects `queued_dttm`,
`end_date`, and `queue` from the TI row and calls `DualStatsManager.timing()`
after the state update. Same first-attempt guard as the original (skips when
`end_date` is set).
Closes: #63503
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Opus 4, claude-opus-4-6)
Generated-by: Claude Code (Opus 4, claude-opus-4-6) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
---
* Read the **[Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
for more information. Note: commit author/co-author name and email in commits
become permanently public when merged.
* For fundamental code changes, an Airflow Improvement Proposal
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
is needed.
--
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]