We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 302d472 commit 860ab10Copy full SHA for 860ab10
datadog_lambda/config.py
@@ -68,6 +68,8 @@ class Config:
68
llmobs_enabled = _get_env("DD_LLMOBS_ENABLED", "false", as_bool)
69
exception_replay_enabled = _get_env("DD_EXCEPTION_REPLAY_ENABLED", "false", as_bool)
70
71
+ local_test = _get_env("DD_LOCAL_TEST", "false", as_bool)
72
+
73
@property
74
def fips_mode_enabled(self):
75
if not hasattr(self, "_config_fips_mode_enabled"):
datadog_lambda/wrapper.py
@@ -67,16 +67,6 @@
67
DD_ENV = "DD_ENV"
-def get_env_as_int(env_key, default_value: int) -> int:
- try:
- return int(os.environ.get(env_key, default_value))
- except Exception as e:
- logger.warn(
- f"Failed to parse {env_key} as int. Using default value: {default_value}. Error: {e}"
76
- )
77
- return default_value
78
-
79
80
init_timestamp_ns = time_ns()
81
82
"""
@@ -150,9 +140,6 @@ def __init__(self, func):
150
140
self.cold_start_tracing = depends_on_dd_tracing_enabled(
151
141
os.environ.get(DD_COLD_START_TRACING, "true").lower() == "true"
152
142
)
153
- self.local_testing_mode = os.environ.get(
154
- DD_LOCAL_TEST, "false"
155
- ).lower() in ("true", "1")
156
143
self.cold_start_trace_skip_lib = [
157
144
"ddtrace.internal.compat",
158
145
"ddtrace.filters",
@@ -357,7 +344,7 @@ def _after(self, event, context):
357
344
from datadog_lambda.metric import flush_stats
358
345
359
346
flush_stats(context)
360
- if should_use_extension and self.local_testing_mode:
347
+ if should_use_extension and self.local_test:
361
348
# when testing locally, the extension does not know when an
362
349
# invocation completes because it does not have access to the
363
350
# logs api
tests/test_config.py
@@ -183,6 +183,15 @@ def set_env(key, value):
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
196
197
0 commit comments