rjgoyln commented on code in PR #73626:
URL: https://github.com/apache/airflow/pull/73626#discussion_r4146620516
##########
shared/observability/tests/observability/test_traces.py:
##########
@@ -360,3 +369,88 @@ def test_roundtrip_via_carrier(self):
span = trace.get_current_span(ctx)
assert get_task_span_detail_level(span) == 3
+
+
+_FORK_SCENARIO = textwrap.dedent(
+ """
+ import os
+ import signal
+ import time
+
+ from opentelemetry.sdk import resources as otel_resources
+
+ from airflow_shared.observability.traces import _ForkSafeTracerProvider
+
+ _ForkSafeTracerProvider() # registers the after_in_child handler under
test
Review Comment:
This scenario currently relies on the default `shutdown_on_exit=True`, which
registers `atexit.register(self.shutdown)` and provides the strong reference
that keeps the SDK's `WeakMethod` alive — the same mechanism documented on the
metrics side. Without that reference, the unassigned provider is otherwise
collectable, so the handler under test never runs. I verified this by removing
the `_handle_fork` override and adding `shutdown_on_exit=False`; the test still
passed, making the regression test effectively vacuous. Worth making the
reference explicit, as in the `MeterProvider` scenario.
```suggestion
# Kept referenced: the SDK registers the after_in_child handler under
test through a WeakMethod.
provider = _ForkSafeTracerProvider(shutdown_on_exit=False)
```
--
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]