@@ -14,194 +14,92 @@ def set_env(key, value):
1414 return set_env
1515
1616
17+ def _test_as_bool (env_key , conf_key , default ):
18+ return (
19+ (env_key , conf_key , None , default ),
20+ (env_key , conf_key , "" , False ),
21+ (env_key , conf_key , "true" , True ),
22+ (env_key , conf_key , "TRUE" , True ),
23+ (env_key , conf_key , "false" , False ),
24+ (env_key , conf_key , "FALSE" , False ),
25+ (env_key , conf_key , "1" , True ), # CHANGED
26+ (env_key , conf_key , "0" , False ),
27+ (env_key , conf_key , "purple" , False ),
28+ )
29+
30+ def _test_int (env_key , conf_key , default ):
31+ return (
32+ (env_key , conf_key , None , default ),
33+ (env_key , conf_key , "" , default ),
34+ (env_key , conf_key , "5" , 5 ),
35+ (env_key , conf_key , "0" , 0 ),
36+ (env_key , conf_key , "2.5" , default ),
37+ (env_key , conf_key , "-1" , - 1 ),
38+ (env_key , conf_key , "purple" , default ),
39+ )
40+
41+ def _test_as_list (env_key , conf_key , default ):
42+ return (
43+ (env_key , conf_key , None , default .split ("," )),
44+ (env_key , conf_key , "" , []),
45+ (env_key , conf_key , " " , []),
46+ (env_key , conf_key , "," , []),
47+ (env_key , conf_key , " , " , []),
48+ (env_key , conf_key , "a" , ["a" ]),
49+ (env_key , conf_key , "a," , ["a" ]),
50+ (env_key , conf_key , "a, " , ["a" ]),
51+ (env_key , conf_key , "a,b" , ["a" , "b" ]),
52+ (env_key , conf_key , "a, b" , ["a" , "b" ]),
53+ )
54+
55+
1756_test_config_from_environ = (
57+ * _test_as_bool ("DD_FLUSH_TO_LOG" , "flush_to_log" , default = False ),
58+ * _test_as_bool ("DD_LOGS_INJECTION" , "logs_injection" , default = True ),
59+ * _test_as_bool ("DD_TRACE_ENABLED" , "trace_enabled" , default = True ),
60+ * _test_as_bool ("DD_COLD_START_TRACING" , "cold_start_tracing" , default = True ),
61+ * _test_as_bool ("DD_FLUSH_IN_THREAD" , "flush_in_thread" , default = False ),
62+ * _test_as_bool ("DD_ENHANCED_METRICS" , "enhanced_metrics_enabled" , default = True ),
63+ * _test_as_bool ("DD_INTEGRATION_TEST" , "is_in_tests" , default = False ),
64+ * _test_as_bool ("DD_BOTOCORE_ADD_SPAN_POINTERS" , "add_span_pointers" , default = True ),
65+ * _test_as_bool ("DD_TRACE_OTEL_ENABLED" , "otel_enabled" , default = False ),
66+ * _test_as_bool ("DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , default = False ),
67+ * _test_as_bool ("DD_MERGE_XRAY_TRACES" , "merge_xray_traces" , default = False ),
68+ * _test_as_bool ("DD_PROFILING_ENABLED" , "profiling_enabled" , default = False ),
69+ * _test_as_bool ("DD_LLMOBS_ENABLED" , "llmobs_enabled" , default = False ),
70+ * _test_as_bool ("DD_EXCEPTION_REPLAY_ENABLED" , "exception_replay_enabled" , default = False ),
71+ * _test_as_bool ("DD_CAPTURE_LAMBDA_PAYLOAD" , "capture_payload_enabled" , default = False ),
72+ * _test_as_bool ("DD_LOCAL_TEST" , "local_test" , default = False ),
73+
74+ * _test_int ("DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH" , "capture_payload_max_depth" , default = 10 ),
75+ * _test_int ("DD_MIN_COLD_START_DURATION" , "min_cold_start_trace_duration" , default = 3 ),
76+
77+ * _test_as_list ("DD_COLD_START_TRACE_SKIP_LIB" , "cold_start_trace_skip_lib" , default = "ddtrace.internal.compat,ddtrace.filters" ),
78+
1879 ("DD_SERVICE" , "service" , None , None ),
1980 ("DD_SERVICE" , "service" , "" , "" ),
2081 ("DD_SERVICE" , "service" , "my_service" , "my_service" ),
82+
2183 ("AWS_LAMBDA_FUNCTION_NAME" , "function_name" , None , "function" ),
2284 ("AWS_LAMBDA_FUNCTION_NAME" , "function_name" , "" , "" ),
2385 ("AWS_LAMBDA_FUNCTION_NAME" , "function_name" , "my_function" , "my_function" ),
24- ("DD_FLUSH_TO_LOG" , "flush_to_log" , None , False ),
25- ("DD_FLUSH_TO_LOG" , "flush_to_log" , "" , False ),
26- ("DD_FLUSH_TO_LOG" , "flush_to_log" , "true" , True ),
27- ("DD_FLUSH_TO_LOG" , "flush_to_log" , "TRUE" , True ),
28- ("DD_FLUSH_TO_LOG" , "flush_to_log" , "false" , False ),
29- ("DD_FLUSH_TO_LOG" , "flush_to_log" , "FALSE" , False ),
30- ("DD_FLUSH_TO_LOG" , "flush_to_log" , "1" , True ), # CHANGED
31- ("DD_FLUSH_TO_LOG" , "flush_to_log" , "0" , False ),
32- ("DD_FLUSH_TO_LOG" , "flush_to_log" , "purple" , False ),
33- ("DD_LOGS_INJECTION" , "logs_injection" , None , True ),
34- ("DD_LOGS_INJECTION" , "logs_injection" , "" , False ),
35- ("DD_LOGS_INJECTION" , "logs_injection" , "true" , True ),
36- ("DD_LOGS_INJECTION" , "logs_injection" , "TRUE" , True ),
37- ("DD_LOGS_INJECTION" , "logs_injection" , "false" , False ),
38- ("DD_LOGS_INJECTION" , "logs_injection" , "FALSE" , False ),
39- ("DD_LOGS_INJECTION" , "logs_injection" , "1" , True ), # CHANGED
40- ("DD_LOGS_INJECTION" , "logs_injection" , "0" , False ),
41- ("DD_LOGS_INJECTION" , "logs_injection" , "purple" , False ),
42- ("DD_TRACE_ENABLED" , "trace_enabled" , None , True ),
43- ("DD_TRACE_ENABLED" , "trace_enabled" , "" , False ),
44- ("DD_TRACE_ENABLED" , "trace_enabled" , "true" , True ),
45- ("DD_TRACE_ENABLED" , "trace_enabled" , "TRUE" , True ),
46- ("DD_TRACE_ENABLED" , "trace_enabled" , "false" , False ),
47- ("DD_TRACE_ENABLED" , "trace_enabled" , "FALSE" , False ),
48- ("DD_TRACE_ENABLED" , "trace_enabled" , "1" , True ), # CHANGED
49- ("DD_TRACE_ENABLED" , "trace_enabled" , "0" , False ),
50- ("DD_TRACE_ENABLED" , "trace_enabled" , "purple" , False ),
51- ("DD_COLD_START_TRACING" , "cold_start_tracing" , None , True ),
52- ("DD_COLD_START_TRACING" , "cold_start_tracing" , "" , False ),
53- ("DD_COLD_START_TRACING" , "cold_start_tracing" , "true" , True ),
54- ("DD_COLD_START_TRACING" , "cold_start_tracing" , "TRUE" , True ),
55- ("DD_COLD_START_TRACING" , "cold_start_tracing" , "false" , False ),
56- ("DD_COLD_START_TRACING" , "cold_start_tracing" , "FALSE" , False ),
57- ("DD_COLD_START_TRACING" , "cold_start_tracing" , "1" , True ), # CHANGED
58- ("DD_COLD_START_TRACING" , "cold_start_tracing" , "0" , False ),
59- ("DD_COLD_START_TRACING" , "cold_start_tracing" , "purple" , False ),
86+
6087 ("AWS_REGION" , "is_gov_region" , None , False ),
6188 ("AWS_REGION" , "is_gov_region" , "" , False ),
6289 ("AWS_REGION" , "is_gov_region" , "us-gov-1" , True ),
6390 ("AWS_REGION" , "is_gov_region" , "us-est-1" , False ),
64- ("DD_FLUSH_IN_THREAD" , "flush_in_thread" , None , False ),
65- ("DD_FLUSH_IN_THREAD" , "flush_in_thread" , "" , False ),
66- ("DD_FLUSH_IN_THREAD" , "flush_in_thread" , "true" , True ),
67- ("DD_FLUSH_IN_THREAD" , "flush_in_thread" , "TRUE" , True ),
68- ("DD_FLUSH_IN_THREAD" , "flush_in_thread" , "false" , False ),
69- ("DD_FLUSH_IN_THREAD" , "flush_in_thread" , "FALSE" , False ),
70- ("DD_FLUSH_IN_THREAD" , "flush_in_thread" , "1" , True ), # CHANGED
71- ("DD_FLUSH_IN_THREAD" , "flush_in_thread" , "0" , False ),
72- ("DD_FLUSH_IN_THREAD" , "flush_in_thread" , "purple" , False ),
73- ("DD_ENHANCED_METRICS" , "enhanced_metrics_enabled" , None , True ),
74- ("DD_ENHANCED_METRICS" , "enhanced_metrics_enabled" , "" , False ),
75- ("DD_ENHANCED_METRICS" , "enhanced_metrics_enabled" , "true" , True ),
76- ("DD_ENHANCED_METRICS" , "enhanced_metrics_enabled" , "TRUE" , True ),
77- ("DD_ENHANCED_METRICS" , "enhanced_metrics_enabled" , "false" , False ),
78- ("DD_ENHANCED_METRICS" , "enhanced_metrics_enabled" , "FALSE" , False ),
79- ("DD_ENHANCED_METRICS" , "enhanced_metrics_enabled" , "1" , True ), # CHANGED
80- ("DD_ENHANCED_METRICS" , "enhanced_metrics_enabled" , "0" , False ),
81- ("DD_ENHANCED_METRICS" , "enhanced_metrics_enabled" , "purple" , False ),
82- ("DD_INTEGRATION_TEST" , "is_in_tests" , None , False ),
83- ("DD_INTEGRATION_TEST" , "is_in_tests" , "" , False ),
84- ("DD_INTEGRATION_TEST" , "is_in_tests" , "true" , True ),
85- ("DD_INTEGRATION_TEST" , "is_in_tests" , "TRUE" , True ),
86- ("DD_INTEGRATION_TEST" , "is_in_tests" , "false" , False ),
87- ("DD_INTEGRATION_TEST" , "is_in_tests" , "FALSE" , False ),
88- ("DD_INTEGRATION_TEST" , "is_in_tests" , "1" , True ), # CHANGED
89- ("DD_INTEGRATION_TEST" , "is_in_tests" , "0" , False ),
90- ("DD_INTEGRATION_TEST" , "is_in_tests" , "purple" , False ),
91- ("DD_BOTOCORE_ADD_SPAN_POINTERS" , "add_span_pointers" , None , True ),
92- ("DD_BOTOCORE_ADD_SPAN_POINTERS" , "add_span_pointers" , "" , False ),
93- ("DD_BOTOCORE_ADD_SPAN_POINTERS" , "add_span_pointers" , "true" , True ),
94- ("DD_BOTOCORE_ADD_SPAN_POINTERS" , "add_span_pointers" , "TRUE" , True ),
95- ("DD_BOTOCORE_ADD_SPAN_POINTERS" , "add_span_pointers" , "false" , False ),
96- ("DD_BOTOCORE_ADD_SPAN_POINTERS" , "add_span_pointers" , "FALSE" , False ),
97- ("DD_BOTOCORE_ADD_SPAN_POINTERS" , "add_span_pointers" , "1" , True ),
98- ("DD_BOTOCORE_ADD_SPAN_POINTERS" , "add_span_pointers" , "0" , False ),
99- ("DD_BOTOCORE_ADD_SPAN_POINTERS" , "add_span_pointers" , "purple" , False ),
100- ("DD_TRACE_OTEL_ENABLED" , "otel_enabled" , None , False ),
101- ("DD_TRACE_OTEL_ENABLED" , "otel_enabled" , "" , False ),
102- ("DD_TRACE_OTEL_ENABLED" , "otel_enabled" , "true" , True ),
103- ("DD_TRACE_OTEL_ENABLED" , "otel_enabled" , "TRUE" , True ),
104- ("DD_TRACE_OTEL_ENABLED" , "otel_enabled" , "false" , False ),
105- ("DD_TRACE_OTEL_ENABLED" , "otel_enabled" , "FALSE" , False ),
106- ("DD_TRACE_OTEL_ENABLED" , "otel_enabled" , "1" , True ), # CHANGED
107- ("DD_TRACE_OTEL_ENABLED" , "otel_enabled" , "0" , False ),
108- ("DD_TRACE_OTEL_ENABLED" , "otel_enabled" , "purple" , False ),
91+
10992 ("AWS_LAMBDA_FUNCTION_NAME" , "is_lambda_context" , None , False ),
11093 ("AWS_LAMBDA_FUNCTION_NAME" , "is_lambda_context" , "" , False ),
11194 ("AWS_LAMBDA_FUNCTION_NAME" , "is_lambda_context" , "my_function" , True ),
112- ("DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , None , False ),
113- ("DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , "" , False ),
114- ("DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , "true" , True ),
115- ("DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , "TRUE" , True ),
116- ("DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , "false" , False ),
117- ("DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , "FALSE" , False ),
118- ("DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , "1" , True ), # CHANGED
119- ("DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , "0" , False ),
120- ("DD_INSTRUMENTATION_TELEMETRY_ENABLED" , "telemetry_enabled" , "purple" , False ),
121- ("DD_MERGE_XRAY_TRACES" , "merge_xray_traces" , None , False ),
122- ("DD_MERGE_XRAY_TRACES" , "merge_xray_traces" , "" , False ),
123- ("DD_MERGE_XRAY_TRACES" , "merge_xray_traces" , "true" , True ),
124- ("DD_MERGE_XRAY_TRACES" , "merge_xray_traces" , "TRUE" , True ),
125- ("DD_MERGE_XRAY_TRACES" , "merge_xray_traces" , "false" , False ),
126- ("DD_MERGE_XRAY_TRACES" , "merge_xray_traces" , "FALSE" , False ),
127- ("DD_MERGE_XRAY_TRACES" , "merge_xray_traces" , "1" , True ), # CHANGED
128- ("DD_MERGE_XRAY_TRACES" , "merge_xray_traces" , "0" , False ),
129- ("DD_MERGE_XRAY_TRACES" , "merge_xray_traces" , "purple" , False ),
95+
13096 ("DD_TRACE_EXTRACTOR" , "trace_extractor" , None , None ),
13197 ("DD_TRACE_EXTRACTOR" , "trace_extractor" , "" , "" ),
13298 ("DD_TRACE_EXTRACTOR" , "trace_extractor" , "my_extractor" , "my_extractor" ),
133- ("DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH" , "capture_payload_max_depth" , None , 10 ),
134- ("DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH" , "capture_payload_max_depth" , "" , 10 ),
135- ("DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH" , "capture_payload_max_depth" , "5" , 5 ),
136- ("DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH" , "capture_payload_max_depth" , "0" , 0 ),
137- ("DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH" , "capture_payload_max_depth" , "2.5" , 10 ),
138- ("DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH" , "capture_payload_max_depth" , "-1" , - 1 ),
139- ("DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH" , "capture_payload_max_depth" , "purple" , 10 ),
140- ("DD_PROFILING_ENABLED" , "profiling_enabled" , None , False ),
141- ("DD_PROFILING_ENABLED" , "profiling_enabled" , "" , False ),
142- ("DD_PROFILING_ENABLED" , "profiling_enabled" , "true" , True ),
143- ("DD_PROFILING_ENABLED" , "profiling_enabled" , "TRUE" , True ),
144- ("DD_PROFILING_ENABLED" , "profiling_enabled" , "false" , False ),
145- ("DD_PROFILING_ENABLED" , "profiling_enabled" , "FALSE" , False ),
146- ("DD_PROFILING_ENABLED" , "profiling_enabled" , "1" , True ), # CHANGED
147- ("DD_PROFILING_ENABLED" , "profiling_enabled" , "0" , False ),
148- ("DD_PROFILING_ENABLED" , "profiling_enabled" , "purple" , False ),
149- ("DD_LLMOBS_ENABLED" , "llmobs_enabled" , None , False ),
150- ("DD_LLMOBS_ENABLED" , "llmobs_enabled" , "" , False ),
151- ("DD_LLMOBS_ENABLED" , "llmobs_enabled" , "true" , True ),
152- ("DD_LLMOBS_ENABLED" , "llmobs_enabled" , "TRUE" , True ),
153- ("DD_LLMOBS_ENABLED" , "llmobs_enabled" , "false" , False ),
154- ("DD_LLMOBS_ENABLED" , "llmobs_enabled" , "FALSE" , False ),
155- ("DD_LLMOBS_ENABLED" , "llmobs_enabled" , "1" , True ), # CHANGED
156- ("DD_LLMOBS_ENABLED" , "llmobs_enabled" , "0" , False ),
157- ("DD_LLMOBS_ENABLED" , "llmobs_enabled" , "purple" , False ),
158- ("DD_EXCEPTION_REPLAY_ENABLED" , "exception_replay_enabled" , None , False ),
159- ("DD_EXCEPTION_REPLAY_ENABLED" , "exception_replay_enabled" , "" , False ),
160- ("DD_EXCEPTION_REPLAY_ENABLED" , "exception_replay_enabled" , "true" , True ),
161- ("DD_EXCEPTION_REPLAY_ENABLED" , "exception_replay_enabled" , "TRUE" , True ),
162- ("DD_EXCEPTION_REPLAY_ENABLED" , "exception_replay_enabled" , "false" , False ),
163- ("DD_EXCEPTION_REPLAY_ENABLED" , "exception_replay_enabled" , "FALSE" , False ),
164- ("DD_EXCEPTION_REPLAY_ENABLED" , "exception_replay_enabled" , "1" , True ), # CHANGED
165- ("DD_EXCEPTION_REPLAY_ENABLED" , "exception_replay_enabled" , "0" , False ),
166- ("DD_EXCEPTION_REPLAY_ENABLED" , "exception_replay_enabled" , "purple" , False ),
99+
167100 ("DD_ENV" , "env" , None , None ),
168101 ("DD_ENV" , "env" , "" , "" ),
169102 ("DD_ENV" , "env" , "my_env" , "my_env" ),
170- ("DD_CAPTURE_LAMBDA_PAYLOAD" , "capture_payload_enabled" , None , False ),
171- ("DD_CAPTURE_LAMBDA_PAYLOAD" , "capture_payload_enabled" , "" , False ),
172- ("DD_CAPTURE_LAMBDA_PAYLOAD" , "capture_payload_enabled" , "true" , True ),
173- ("DD_CAPTURE_LAMBDA_PAYLOAD" , "capture_payload_enabled" , "TRUE" , True ),
174- ("DD_CAPTURE_LAMBDA_PAYLOAD" , "capture_payload_enabled" , "false" , False ),
175- ("DD_CAPTURE_LAMBDA_PAYLOAD" , "capture_payload_enabled" , "FALSE" , False ),
176- ("DD_CAPTURE_LAMBDA_PAYLOAD" , "capture_payload_enabled" , "1" , True ), # CHANGED
177- ("DD_CAPTURE_LAMBDA_PAYLOAD" , "capture_payload_enabled" , "0" , False ),
178- ("DD_CAPTURE_LAMBDA_PAYLOAD" , "capture_payload_enabled" , "purple" , False ),
179- ("DD_MIN_COLD_START_DURATION" , "min_cold_start_trace_duration" , None , 3 ),
180- ("DD_MIN_COLD_START_DURATION" , "min_cold_start_trace_duration" , "" , 3 ),
181- ("DD_MIN_COLD_START_DURATION" , "min_cold_start_trace_duration" , "5" , 5 ),
182- ("DD_MIN_COLD_START_DURATION" , "min_cold_start_trace_duration" , "0" , 0 ),
183- ("DD_MIN_COLD_START_DURATION" , "min_cold_start_trace_duration" , "2.5" , 3 ),
184- ("DD_MIN_COLD_START_DURATION" , "min_cold_start_trace_duration" , "-1" , - 1 ),
185- ("DD_MIN_COLD_START_DURATION" , "min_cold_start_trace_duration" , "purple" , 3 ),
186- ("DD_LOCAL_TEST" , "local_test" , None , False ),
187- ("DD_LOCAL_TEST" , "local_test" , "" , False ),
188- ("DD_LOCAL_TEST" , "local_test" , "true" , True ),
189- ("DD_LOCAL_TEST" , "local_test" , "TRUE" , True ),
190- ("DD_LOCAL_TEST" , "local_test" , "false" , False ),
191- ("DD_LOCAL_TEST" , "local_test" , "FALSE" , False ),
192- ("DD_LOCAL_TEST" , "local_test" , "1" , True ), # CHANGED
193- ("DD_LOCAL_TEST" , "local_test" , "0" , False ),
194- ("DD_LOCAL_TEST" , "local_test" , "purple" , False ),
195- ("DD_COLD_START_TRACE_SKIP_LIB" , "cold_start_trace_skip_lib" , None , ["ddtrace.internal.compat" , "ddtrace.filters" ]),
196- ("DD_COLD_START_TRACE_SKIP_LIB" , "cold_start_trace_skip_lib" , "" , []),
197- ("DD_COLD_START_TRACE_SKIP_LIB" , "cold_start_trace_skip_lib" , " " , []),
198- ("DD_COLD_START_TRACE_SKIP_LIB" , "cold_start_trace_skip_lib" , "," , []),
199- ("DD_COLD_START_TRACE_SKIP_LIB" , "cold_start_trace_skip_lib" , " , " , []),
200- ("DD_COLD_START_TRACE_SKIP_LIB" , "cold_start_trace_skip_lib" , "a" , ["a" ]),
201- ("DD_COLD_START_TRACE_SKIP_LIB" , "cold_start_trace_skip_lib" , "a," , ["a" ]),
202- ("DD_COLD_START_TRACE_SKIP_LIB" , "cold_start_trace_skip_lib" , "a, " , ["a" ]),
203- ("DD_COLD_START_TRACE_SKIP_LIB" , "cold_start_trace_skip_lib" , "a,b" , ["a" , "b" ]),
204- ("DD_COLD_START_TRACE_SKIP_LIB" , "cold_start_trace_skip_lib" , "a, b" , ["a" , "b" ]),
205103)
206104
207105
0 commit comments