potiuk commented on code in PR #61655:
URL: https://github.com/apache/airflow/pull/61655#discussion_r2927539696
##########
shared/observability/src/airflow_shared/observability/traces/otel_tracer.py:
##########
@@ -291,8 +292,10 @@ def inject(self) -> dict:
TraceContextTextMapPropagator().inject(carrier)
return carrier
- def extract(self, carrier: dict) -> Context:
+ def extract(self, carrier: dict | None) -> Context:
"""Extract the span context from a provided carrier."""
Review Comment:
**Bug: Wrong return type — returns `dict` instead of `Context`.**
Returning `{}` (a plain `dict`) violates the `Context` return type
annotation. OpenTelemetry's `Context` is a subclass of `dict` (`class
Context(typing.Dict[str, object])`), so when this value is passed downstream to
`start_child_span()` → `_new_span()` →
`tracer.start_as_current_span(context=...)`, OTel receives a plain dict instead
of a `Context` object.
This should return `Context()` instead.
--
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]