File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,6 +115,11 @@ def set_trace_configurations(self) -> None:
115115 "trace_correlation" , True
116116 )
117117
118+ if "INSTANA_ASYNCIO_TASK_CONTEXT_PROPAGATION" in os .environ :
119+ config ["asyncio_task_context_propagation" ]["enabled" ] = is_truthy (
120+ os .environ ["INSTANA_ASYNCIO_TASK_CONTEXT_PROPAGATION" ]
121+ )
122+
118123 self .set_disable_trace_configurations ()
119124 self .set_stack_trace_configurations ()
120125 self .set_span_filter_configurations ()
Original file line number Diff line number Diff line change @@ -842,6 +842,23 @@ def test_tracing_filter_environment_variables(self) -> None:
842842 ],
843843 }
844844
845+ def test_asyncio_task_context_propagation_default (self ) -> None :
846+ """INSTANA_ASYNCIO_TASK_CONTEXT_PROPAGATION is False by default."""
847+ self .base_options = BaseOptions ()
848+ assert config ["asyncio_task_context_propagation" ]["enabled" ] is False
849+
850+ @patch .dict (os .environ , {"INSTANA_ASYNCIO_TASK_CONTEXT_PROPAGATION" : "true" })
851+ def test_asyncio_task_context_propagation_enabled_via_env (self ) -> None :
852+ """INSTANA_ASYNCIO_TASK_CONTEXT_PROPAGATION=true enables the flag."""
853+ self .base_options = BaseOptions ()
854+ assert config ["asyncio_task_context_propagation" ]["enabled" ] is True
855+
856+ @patch .dict (os .environ , {"INSTANA_ASYNCIO_TASK_CONTEXT_PROPAGATION" : "false" })
857+ def test_asyncio_task_context_propagation_disabled_via_env (self ) -> None :
858+ """INSTANA_ASYNCIO_TASK_CONTEXT_PROPAGATION=false keeps the flag disabled."""
859+ self .base_options = BaseOptions ()
860+ assert config ["asyncio_task_context_propagation" ]["enabled" ] is False
861+
845862
846863class TestStandardOptions :
847864 @pytest .fixture (autouse = True )
You can’t perform that action at this time.
0 commit comments