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 2c2162f commit 6e1eb1aCopy full SHA for 6e1eb1a
datadog_lambda/config.py
@@ -59,6 +59,7 @@ class Config:
59
trace_extractor = _get_env("DD_TRACE_EXTRACTOR")
60
capture_payload_max_depth = _get_env("DD_CAPTURE_PAYLOAD_MAX_DEPTH", 10, int)
61
profiling_enabled = _get_env("DD_PROFILING_ENABLED", "false", as_bool)
62
+ llmobs_enabled = _get_env("DD_LLMOBS_ENABLED", "false", as_bool)
63
64
@property
65
def fips_mode_enabled(self):
datadog_lambda/wrapper.py
@@ -48,8 +48,7 @@
48
if config.profiling_enabled:
49
from ddtrace.profiling import profiler
50
51
-llmobs_env_var = os.environ.get("DD_LLMOBS_ENABLED", "false").lower() in ("true", "1")
52
-if llmobs_env_var:
+if config.llmobs_enabled:
53
from ddtrace.llmobs import LLMObs
54
55
exception_replay_env_var = os.environ.get(
@@ -203,7 +202,7 @@ def __init__(self, func):
203
202
patch_all()
204
205
# Enable LLM Observability
206
- if llmobs_env_var:
+ if config.llmobs_enabled:
207
LLMObs.enable()
208
209
# Enable Exception Replay
@@ -378,7 +377,7 @@ def _after(self, event, context):
378
377
# logs api
379
flush_extension()
380
381
382
LLMObs.flush()
383
384
if self.encode_authorizer_context and is_authorizer_response(self.response):
tests/test_config.py
@@ -146,6 +146,15 @@ def set_env(key, value):
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
)
159
160
0 commit comments