rammmaa opened a new pull request, #73150: URL: https://github.com/apache/airflow/pull/73150
## Problem The scheduler scans for task instances without a recent heartbeat synchronously in its main loop. If that database query is slow, the scheduler can miss its own heartbeat and appear unhealthy, while operators have no metric or log message identifying this scan as the cause. ## Fix - Measure the scan with the `scheduler.task_instance_heartbeat_timeout_scan_duration` timer. - Log a warning when the scan exceeds the scheduler health-check threshold, including when the query ends in a database error. - Register the timer in the metrics registry and cover both sides of the threshold plus the error path. ## Tests - `breeze ci selective-check --commit-ref HEAD` - `breeze testing core-tests --run-in-parallel` (API, Always, CLI, Core, Other, and Serialization all passed) - Breeze Python 3.10: `pytest airflow-core/tests/unit/jobs/test_scheduler_job.py -k heartbeat_timeout -q` (21 passed) - `prek run --from-ref upstream/main --stage pre-commit` - `prek run --from-ref upstream/main --stage manual --skip compile-ui-assets-dev --skip view-skill-eval --skip run-skill-eval-codex` - `breeze build-docs` (all 114 documentation packages and spell checks passed) ## Note This change adds observability only. It does not alter the scan query or task-instance heartbeat-timeout behavior. closes: #32986 --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Fable 5.1) and Codex (GPT-5) Generated-by: Claude Code (Fable 5.1) and Codex (GPT-5) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/18_contributor_documentation.rst#use-of-generative-ai). --- Drafted-by: Codex (GPT-5) (no human review before posting) -- 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]
