c-premus opened a new pull request, #66053:
URL: https://github.com/apache/airflow/pull/66053

   ## Summary
   
   `_emit_task_span()` in the execution API was setting the 
`airflow.task_instance.id` span attribute to the raw `UUID` object. The OTEL 
SDK only accepts `str / bytes / int / float / bool` attribute values (or 
homogeneous sequences), so it dropped the attribute and logged a warning per 
task state transition:
   
   ```
   [warning  ] Invalid type UUID for attribute 'airflow.task_instance.id' 
value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence 
of those types [opentelemetry.attributes] correlation_id=... 
loc=__init__.py:119 ti_id=...
   ```
   
   The fix stringifies the UUID, matching the convention already used at the 
top of the same module (`bind_contextvars(ti_id=str(task_instance_id))`).
   
   ## Root cause
   
   Introduced in #63839 (merged 2026-03-24, "Introduce parent task spans and 
nest worker and trigger spans under them"). First shipped in 3.2.0; 
reproducible on 3.2.1 and `main`.
   
   ## Reproduction
   
   1. Run Airflow 3.2.x with native OTEL tracing enabled (`[traces] otel_on = 
True` and an OTLP endpoint).
   2. Trigger any DAG.
   3. `docker logs <api-server> | grep "Invalid type UUID"` — one warning per 
task state transition.
   
   ## Impact
   
   Cosmetic but noisy — the task itself runs fine, the span is still emitted 
with the other attributes (`dag_id`, `task_id`, `run_id`, `try_number`, 
`map_index`, `state`), only the TI UUID attribute is dropped. This prevents 
trace search by task instance ID in the trace backend.
   
   ## Tests
   
   Extended `TestEmitTaskSpan.test_emit_task_span_sets_attributes` to set a 
real UUID on the mock TI and assert the span attribute is present, equal to 
`str(ti.id)`, and of type `str`.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Anthropic) 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]

Reply via email to