6
6
7
7
from pkg_resources import DistributionNotFound , require
8
8
9
+ from amazon .opentelemetry .distro .aws_opentelemetry_distro import AwsOpenTelemetryDistro
10
+
9
11
10
12
class TestAwsOpenTelemetryDistro (TestCase ):
11
13
def test_package_available (self ):
@@ -41,8 +43,6 @@ def test_agent_observability_sets_new_defaults(self):
41
43
os .environ ["AGENT_OBSERVABILITY_ENABLED" ] = "true"
42
44
43
45
# Import and configure
44
- from amazon .opentelemetry .distro .aws_opentelemetry_distro import AwsOpenTelemetryDistro
45
-
46
46
with patch ("amazon.opentelemetry.distro.aws_opentelemetry_distro.apply_instrumentation_patches" ):
47
47
with patch ("amazon.opentelemetry.distro.aws_opentelemetry_distro.get_aws_region" , return_value = "us-west-2" ):
48
48
# We need to mock the parent class to avoid its side effects
@@ -54,7 +54,8 @@ def test_agent_observability_sets_new_defaults(self):
54
54
self .assertEqual (os .environ .get ("OTEL_TRACES_SAMPLER" ), "parentbased_always_on" )
55
55
self .assertEqual (
56
56
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" ,
58
59
)
59
60
self .assertEqual (os .environ .get ("OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED" ), "true" )
60
61
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):
63
64
# Don't set AGENT_OBSERVABILITY_ENABLED or set it to false
64
65
os .environ .pop ("AGENT_OBSERVABILITY_ENABLED" , None )
65
66
66
- from amazon .opentelemetry .distro .aws_opentelemetry_distro import AwsOpenTelemetryDistro
67
-
68
67
with patch ("amazon.opentelemetry.distro.aws_opentelemetry_distro.apply_instrumentation_patches" ):
69
68
with patch ("opentelemetry.distro.OpenTelemetryDistro._configure" ):
70
69
distro = AwsOpenTelemetryDistro ()
0 commit comments