nickstenning commented on code in PR #61897:
URL: https://github.com/apache/airflow/pull/61897#discussion_r2852565367
##########
airflow-core/src/airflow/executors/base_executor.py:
##########
@@ -134,15 +134,32 @@ def get_mandatory_value(self, *args, **kwargs) -> str:
return conf.get_mandatory_value(*args, **kwargs,
team_name=self.team_name)
+@contextmanager
+def start_ti_span(ti):
+ if isinstance(ti, workloads.TaskInstance):
+ parent_context = Trace.extract(ti.parent_context_carrier)
+ else:
+ parent_context = Trace.extract(ti.dag_run.context_carrier)
+ # Start a new span using the context from the parent.
+ # Attributes will be set once the task has finished so that all
+ # values will be available (end_time, duration, etc.).
+
+ tracer = Trace.get_tracer("dagrun")
+ with tracer.start_as_current_span(f"task.triggered.{ti.task_id}",
context=parent_context) as span:
Review Comment:
Should it still be `triggered` if this is going to live for the whole task?
I'm guessing 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]