dstandish opened a new pull request, #67659: URL: https://github.com/apache/airflow/pull/67659
Follow-up to #67347 (which added `listener.<hook_name>` spans). This wraps each task callback and pre/post-execute hook invocation in a `callback.<kind>` span, gated on task span detail level > 1. Covered invocations (all routed through `create_executable_runner(...).run(...)` in `task-sdk/.../task_runner.py`): - the five state-change callbacks: `on_execute_callback`, `on_success_callback`, `on_failure_callback`, `on_retry_callback`, `on_skipped_callback` (centralized in `_run_task_state_change_callbacks`) - the `pre_execute` / `post_execute` hooks in `_execute_task` The callback function name and index are recorded as span attributes; a raising state-change callback records `ERROR` status on its span and is still swallowed/logged as before. Note: the span is added at the genuine call sites in `task_runner.py`, **not** pushed down into `create_executable_runner`/`callback_runner.py`, because that runner is also reused to execute the actual task body (`python_callable`) in the standard `PythonOperator` — wrapping there would mislabel the main task execution. Tests: new `TestCallbackSpans` unit tests in `test_task_runner.py` (span presence/attributes at level 2, none at level 1, error recording for a raising callback, pre/post-execute gating) and the otel integration test now asserts `callback.on_execute_callback` → `_execute_task` and `callback.on_success_callback` → `finalize`. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Opus 4.7) Generated-by: Claude Code (Opus 4.7) 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]
