yulit0738 opened a new pull request, #64087:
URL: https://github.com/apache/airflow/pull/64087
## Summary
Fixes a crash in `DagRun._emit_dagrun_span()` when `context_carrier` is
`None` or empty `{}`.
- **Symptom**: `AttributeError: 'NoneType' object has no attribute 'get'`
in `TraceContextTextMapPropagator().extract()`
- **Cause**: DagRuns created before OTel tracing was enabled have
`context_carrier = NULL` in the database. When these DagRuns complete,
`_emit_dagrun_span()` passes `None` directly to `extract()`.
- **Fix**: Early return when `context_carrier` is falsy, consistent with
the existing guard in `task_runner.py:148`.
## Reproduction Path
1. Have existing DagRuns in the database (created before OTel was enabled
→ `context_carrier = NULL`)
2. Enable OTel tracing
3. Those DagRuns complete → `update_state()` → `_emit_dagrun_span()` →
crash
**Note**: This supersedes #61655 which targeted `OtelTrace.extract()` —
that class was since removed in #63452.
## Testing
- Added parametrized unit test covering both `None` and `{}` carrier values
- Verified no span is emitted when carrier is missing (graceful skip)
---
**Was generative AI tooling used to co-author this PR?**
- [X] Yes (please specify the tool below)
Generated-by: Claude (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]