manish1337 commented on code in PR #69809:
URL: https://github.com/apache/airflow/pull/69809#discussion_r4098787001
##########
shared/observability/src/airflow_shared/observability/traces/__init__.py:
##########
@@ -248,11 +267,21 @@ def _load_exporter_from_env() -> SpanExporter:
return ep.load()()
+def set_debug_traces_enabled(enabled: bool) -> None:
+ """Set the debug-traces flag on this module instance."""
+ global _otel_debug_traces_on
+ _otel_debug_traces_on = enabled
+
+
def configure_otel(conf: ConfigParser):
+ global _otel_debug_traces_on
+
otel_on = conf.getboolean("traces", "otel_on", fallback=False)
if not otel_on:
return
+ _otel_debug_traces_on = conf.getboolean("traces", "otel_debug_traces_on",
fallback=False)
Review Comment:
The tests monkeypatch `_otel_debug_traces_on` directly, so nothing covers
`configure_otel` reading the flag (incl. the `otel_on=False` case),
`set_debug_traces_enabled`, or the `settings.py` sync. Dropping the sync would
silently lose executor spans with all tests green. Can we add a couple of tests
here?
##########
airflow-core/src/airflow/settings.py:
##########
@@ -841,6 +841,13 @@ def initialize():
import_local_settings()
configure_logging()
configure_otel(conf)
+ # configure_otel configures only the airflow-core copy of the symlinked
shared traces
+ # module. Set the resolved flag in the task-sdk copy that providers import.
+ from airflow._shared.observability import traces as _core_traces
+ from airflow.sdk._shared.observability.traces import
set_debug_traces_enabled
+
+ debug_traces_on = _core_traces._otel_debug_traces_on
+ set_debug_traces_enabled(debug_traces_on)
Review Comment:
Could `start_debug_span` just read the flag from `conf` lazily instead? Then
this block goes away. Otherwise maybe route it through `common.compat`, which
would also dedupe the 5 fallbacks in the executors.
--
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]