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 @@ -864,6 +864,23 @@ def test_tracing_filter_environment_variables(self) -> None:
864864 ],
865865 }
866866
867+ def test_asyncio_task_context_propagation_default (self ) -> None :
868+ """INSTANA_ASYNCIO_TASK_CONTEXT_PROPAGATION is False by default."""
869+ self .base_options = BaseOptions ()
870+ assert config ["asyncio_task_context_propagation" ]["enabled" ] is False
871+
872+ @patch .dict (os .environ , {"INSTANA_ASYNCIO_TASK_CONTEXT_PROPAGATION" : "true" })
873+ def test_asyncio_task_context_propagation_enabled_via_env (self ) -> None :
874+ """INSTANA_ASYNCIO_TASK_CONTEXT_PROPAGATION=true enables the flag."""
875+ self .base_options = BaseOptions ()
876+ assert config ["asyncio_task_context_propagation" ]["enabled" ] is True
877+
878+ @patch .dict (os .environ , {"INSTANA_ASYNCIO_TASK_CONTEXT_PROPAGATION" : "false" })
879+ def test_asyncio_task_context_propagation_disabled_via_env (self ) -> None :
880+ """INSTANA_ASYNCIO_TASK_CONTEXT_PROPAGATION=false keeps the flag disabled."""
881+ self .base_options = BaseOptions ()
882+ assert config ["asyncio_task_context_propagation" ]["enabled" ] is False
883+
867884
868885class TestStandardOptions :
869886 @pytest .fixture (autouse = True )
You can’t perform that action at this time.
0 commit comments