ashb commented on code in PR #63568:
URL: https://github.com/apache/airflow/pull/63568#discussion_r2974533297
##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -96,6 +100,33 @@
from airflow.sdk.types import RuntimeTaskInstanceProtocol as RuntimeTI
logger = logging.getLogger(__name__)
+tracer = trace.get_tracer(__name__)
+
+
+def _make_trigger_span(
+ ti: TaskInstanceDTO | None, trigger_id: int, name: str
+) -> _AgnosticContextManager[trace.Span]:
+ parent_context = (
+ TraceContextTextMapPropagator().extract(ti.context_carrier) if ti and
ti.context_carrier else None
+ )
+ span_name = f"trigger.{ti.task_id}" if ti else f"trigger.{trigger_id}"
+ if ti and ti.map_index >= 0:
+ span_name += f"_{ti.map_index}"
+ attributes: dict[str, str | int] = {
+ "airflow.trigger.name": name,
+ }
+ if ti:
Review Comment:
If there's not a ti, this is (likely, but not always) an asset watcher, so
including info about the asset might be good in an `else` block
--
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]