You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "henry3260 (via GitHub)" <gi...@apache.org> on 2026/05/24 17:21:09 UTC

[PR] Fix Dag run span parent context handling [airflow]

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

   ## Why
   
   Dag run spans are currently forced to root by always passing an empty context when the span is created.
   
   That is useful for Dag runs created by Airflow entry points such as the API, scheduler, asset scheduling, UI trigger, and backfill, since those runs represent new workflow roots.
   
   closes: #67210
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, please
   change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
   -->
   
   - [x] Yes (please specify the tool below)
   Codex GPT 5.5
   <!--
   Generated-by: [Tool Name] 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.
   * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix Dag run span parent context handling [airflow]

Posted by "xBis7 (via GitHub)" <gi...@apache.org>.
xBis7 commented on code in PR #67424:
URL: https://github.com/apache/airflow/pull/67424#discussion_r3467401333


##########
airflow-core/src/airflow/models/dagrun.py:
##########
@@ -1056,7 +1069,17 @@ def is_effective_leaf(task):
         leaf_tis = {ti for ti in tis if ti.task_id in leaf_task_ids if ti.state != TaskInstanceState.REMOVED}
         return leaf_tis
 
-    def _emit_dagrun_span(self, state: DagRunState):
+    def _should_force_root_dagrun_span(self) -> bool:

Review Comment:
   When is a dag run span supposed to not be root? Who should have triggered it?
   
   What happens if we add a new span under the scheduler and the scheduler triggers a dag_run, whose span isn't root? The span is going to be a child of the scheduler's span. Is it something we want to do or not?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix Dag run span parent context handling [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish commented on PR #67424:
URL: https://github.com/apache/airflow/pull/67424#issuecomment-4919538209

   Alternative that allows embedding into a parent trace via dag run conf: https://github.com/apache/airflow/pull/69633
   
   cc @ashb @xBis7 @jedcunningham 


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix Dag run span parent context handling [airflow]

Posted by "henry3260 (via GitHub)" <gi...@apache.org>.
henry3260 closed pull request #67424: Fix Dag run span parent context handling
URL: https://github.com/apache/airflow/pull/67424


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix Dag run span parent context handling [airflow]

Posted by "henry3260 (via GitHub)" <gi...@apache.org>.
henry3260 commented on PR #67424:
URL: https://github.com/apache/airflow/pull/67424#issuecomment-5016881173

   Closing in favor of #69633 


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix Dag run span parent context handling [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #67424:
URL: https://github.com/apache/airflow/pull/67424#discussion_r3468253007


##########
airflow-core/src/airflow/models/dagrun.py:
##########
@@ -1056,7 +1069,17 @@ def is_effective_leaf(task):
         leaf_tis = {ti for ti in tis if ti.task_id in leaf_task_ids if ti.state != TaskInstanceState.REMOVED}
         return leaf_tis
 
-    def _emit_dagrun_span(self, state: DagRunState):
+    def _should_force_root_dagrun_span(self) -> bool:

Review Comment:
   I agree. I think the dag run should be the root span, not the web request which creates it.
   
   A link between the dag run root span and the request span would make sense, but to me putting the dag run spans under this API just doesn't make sense.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org