Skip to content

Commit baedfd0

Browse files
committed
Add exception_replay_enabled.
1 parent 6e1eb1a commit baedfd0

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

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
@@ -51,10 +51,7 @@
5151
if config.llmobs_enabled:
5252
from ddtrace.llmobs import LLMObs
5353

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

6057
logger = logging.getLogger(__name__)
@@ -206,7 +203,7 @@ def __init__(self, func):
206203
LLMObs.enable()
207204

208205
# Enable Exception Replay
209-
if exception_replay_env_var:
206+
if config.exception_replay_enabled:
210207
logger.debug("Enabling exception replay")
211208
SpanExceptionHandler.enable()
212209

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)