xBis7 commented on code in PR #62554:
URL: https://github.com/apache/airflow/pull/62554#discussion_r2894942974
##########
airflow-core/src/airflow/models/dagrun.py:
##########
@@ -369,7 +368,15 @@ def __init__(
self.triggered_by = triggered_by
self.triggering_user_name = triggering_user_name
self.scheduled_by_job_id = None
- self.context_carrier = {}
+ self.context_carrier: dict[str, str] = {}
+
+ # We never call .end() on this span. It's solely used to generate a
trace context for the rest of the run.
+ empty_context = context.Context()
+ span = tracer.start_span("notused", context=empty_context)
Review Comment:
If it never ends, then it will never get exported and yes it will never
appear.
Once the spans are exported, then they are linked together and the parent is
set as the root. This is because the root is the one that points to an invalid
parent. If the parent context belongs to a span that hasn't ended and exported,
then it's essentially pointing to something that doesn't exist.
Let's assume that we have `notused`, `dag_run1`, `task1`, `task1-sub-span`.
* `task1`, `task1-sub-span` get exported -> `task1` is the parent - root
* `dag_run1` gets exported -> `dag_run1` is the new parent - root
--
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]