66
77from pkg_resources import DistributionNotFound , require
88
9+ from amazon .opentelemetry .distro .aws_opentelemetry_distro import AwsOpenTelemetryDistro
10+
911
1012class TestAwsOpenTelemetryDistro (TestCase ):
1113 def test_package_available (self ):
@@ -41,8 +43,6 @@ def test_agent_observability_sets_new_defaults(self):
4143 os .environ ["AGENT_OBSERVABILITY_ENABLED" ] = "true"
4244
4345 # Import and configure
44- from amazon .opentelemetry .distro .aws_opentelemetry_distro import AwsOpenTelemetryDistro
45-
4646 with patch ("amazon.opentelemetry.distro.aws_opentelemetry_distro.apply_instrumentation_patches" ):
4747 with patch ("amazon.opentelemetry.distro.aws_opentelemetry_distro.get_aws_region" , return_value = "us-west-2" ):
4848 # We need to mock the parent class to avoid its side effects
@@ -54,7 +54,8 @@ def test_agent_observability_sets_new_defaults(self):
5454 self .assertEqual (os .environ .get ("OTEL_TRACES_SAMPLER" ), "parentbased_always_on" )
5555 self .assertEqual (
5656 os .environ .get ("OTEL_PYTHON_DISABLED_INSTRUMENTATIONS" ),
57- "http,sqlalchemy,psycopg2,pymysql,sqlite3,aiopg,asyncpg,mysql_connector,botocore,boto3,urllib3,requests,starlette" ,
57+ "http,sqlalchemy,psycopg2,pymysql,sqlite3,aiopg,asyncpg,mysql_connector,"
58+ "botocore,boto3,urllib3,requests,starlette" ,
5859 )
5960 self .assertEqual (os .environ .get ("OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED" ), "true" )
6061 self .assertEqual (os .environ .get ("OTEL_AWS_APPLICATION_SIGNALS_ENABLED" ), "false" )
@@ -63,8 +64,6 @@ def test_new_defaults_not_set_when_agent_observability_disabled(self):
6364 # Don't set AGENT_OBSERVABILITY_ENABLED or set it to false
6465 os .environ .pop ("AGENT_OBSERVABILITY_ENABLED" , None )
6566
66- from amazon .opentelemetry .distro .aws_opentelemetry_distro import AwsOpenTelemetryDistro
67-
6867 with patch ("amazon.opentelemetry.distro.aws_opentelemetry_distro.apply_instrumentation_patches" ):
6968 with patch ("opentelemetry.distro.OpenTelemetryDistro._configure" ):
7069 distro = AwsOpenTelemetryDistro ()
0 commit comments