@@ -677,6 +677,24 @@ def test_get_configurations_env_vars_trace_id_ratio(self, resource_create_mock):
677677 self .assertEqual (configurations ["resource" ].attributes , TEST_DEFAULT_RESOURCE .attributes )
678678 self .assertEqual (configurations ["sampling_arg" ], 0.75 )
679679 self .assertEqual (configurations ["sampler_type" ], "trace_id_ratio" )
680+
681+ @patch .dict (
682+ "os.environ" ,
683+ {
684+ OTEL_PYTHON_DISABLED_INSTRUMENTATIONS : "flask,requests,fastapi,azure_sdk" ,
685+ OTEL_TRACES_SAMPLER : TRACE_ID_RATIO_SAMPLER ,
686+ OTEL_TRACES_SAMPLER_ARG : "sampler" ,
687+ },
688+ clear = True ,
689+ )
690+ @patch ("opentelemetry.sdk.resources.Resource.create" , return_value = TEST_DEFAULT_RESOURCE )
691+ def test_get_configurations_env_vars_trace_id_ratio_non_numeric_value (self , resource_create_mock ):
692+ configurations = _get_configurations ()
693+
694+ self .assertTrue ("connection_string" not in configurations )
695+ self .assertEqual (configurations ["resource" ].attributes , TEST_DEFAULT_RESOURCE .attributes )
696+ self .assertEqual (configurations ["sampling_arg" ], 1.0 )
697+ self .assertEqual (configurations ["sampler_type" ], "trace_id_ratio" )
680698
681699 @patch .dict (
682700 "os.environ" ,
@@ -721,6 +739,7 @@ def test_get_configurations_env_vars_parentbased_always_on(self, resource_create
721739 },
722740 clear = True ,
723741 )
742+
724743 @patch ("opentelemetry.sdk.resources.Resource.create" , return_value = TEST_DEFAULT_RESOURCE )
725744 def test_get_configurations_env_vars_parentbased_always_off (self , resource_create_mock ):
726745 configurations = _get_configurations ()
0 commit comments