Skip to content

Commit 62378bc

Browse files
committed
Add exception_replay_enabled.
1 parent 63b3d4f commit 62378bc

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

datadog_lambda/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class Config:
6060
capture_payload_max_depth = _get_env("DD_CAPTURE_PAYLOAD_MAX_DEPTH", 10, int)
6161
profiling_enabled = _get_env("DD_PROFILING_ENABLED", "false", as_bool)
6262
llmobs_enabled = _get_env("DD_LLMOBS_ENABLED", "false", as_bool)
63+
exception_replay_enabled = _get_env("DD_EXCEPTION_REPLAY_ENABLED", "false", as_bool)
6364

6465
@property
6566
def fips_mode_enabled(self):

datadog_lambda/wrapper.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@
5252
if config.llmobs_enabled:
5353
from ddtrace.llmobs import LLMObs
5454

55-
exception_replay_env_var = os.environ.get(
56-
"DD_EXCEPTION_REPLAY_ENABLED", "false"
57-
).lower() in ("true", "1")
58-
if exception_replay_env_var:
55+
if config.exception_replay_enabled:
5956
from ddtrace.debugging._exception.replay import SpanExceptionHandler
6057
from ddtrace.debugging._uploader import LogsIntakeUploaderV1
6158

@@ -212,7 +209,7 @@ def __init__(self, func):
212209
LLMObs.enable()
213210

214211
# Enable Exception Replay
215-
if exception_replay_env_var:
212+
if config.exception_replay_enabled:
216213
logger.debug("Enabling exception replay")
217214
SpanExceptionHandler.enable()
218215

tests/test_config.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ def set_env(key, value):
155155
("DD_LLMOBS_ENABLED", "llmobs_enabled", "1", True), # CHANGED
156156
("DD_LLMOBS_ENABLED", "llmobs_enabled", "0", False),
157157
("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),
158167
)
159168

160169

0 commit comments

Comments
 (0)