myps6415 opened a new pull request, #76737:
URL: https://github.com/apache/airflow/pull/76737

   The scheduler has emitted `ti.awaiting_input` alongside the other task-state 
gauges since #68028, but the metric was never added to the metrics registry. 
The legacy name (`ti.<state>.{queue}.{dag_id}.{task_id}`) is looked up from the 
registry, so none was exported for this state.
   
   With plain StatsD, which drops tags (the Helm chart's default), every Dag 
and task wrote to the same `ti.awaiting_input` series, and its value was 
whichever count was sent last. Tag-aware backends were not affected.
   
   This registers `ti.awaiting_input` the same way as `ti.deferred`, which also 
adds it to the generated metrics docs, and lists the state in the `[scheduler] 
ti_metrics_interval` description. The `check-metrics-synced-with-registry` hook 
did not catch it because it matches the dynamic `f"ti.{state}"` name against 
the existing `ti.*` entries. The Helm chart's StatsD exporter mapping for the 
new legacy name will follow in a separate PR.
   
   ## Test plan
   
   - [x] `test_gauge_emits_both_when_legacy_name_exists[ti.awaiting_input]` 
fails without the registry entry and passes with it.
   - [x] Recorded what a plain-StatsD `SafeStatsdLogger` receives for two Dags: 
before, only `ti.awaiting_input` (3.0 overwritten by 1.0); after, 
`ti.awaiting_input.default.dag_a.task_1` and 
`ti.awaiting_input.default.dag_b.task_2` as well.
   - [x] In Breeze, a throwaway test ran `SchedulerJobRunner._emit_ti_metrics` 
on a task instance in `awaiting_input`: 
`ti.awaiting_input.default.<dag_id>.<task_id>` is emitted, then reset to 0 once 
the task leaves the state. It fails without the registry entry.
   - [x] `shared/observability` metrics tests: 158 passed; 
`test_otel_logger.py::TestOtelMetrics::test_reinit_after_fork_exports_metrics` 
fails the same way on unchanged `main`.
   - [x] `ruff`, and `prek` at the pre-commit and manual stages, pass.
   - [ ] The full core test suites and the docs build that `breeze verify` 
lists were not run locally; leaving those to CI.
   
   related: #68028
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5.5)
   
   Generated-by: Claude Code (Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


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