Skip to content

Commit 82a943a

Browse files
committed
enable llmobs agentless with parsed api_key
1 parent fc0beaa commit 82a943a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

datadog_lambda/wrapper.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,16 @@
5656
if profiling_env_var:
5757
from ddtrace.profiling import profiler
5858

59+
llmobs_api_key = None
5960
llmobs_env_var = os.environ.get("DD_LLMOBS_ENABLED", "false").lower() in ("true", "1")
6061
if llmobs_env_var:
62+
from datadog_lambda.api import init_api
63+
from datadog import api
6164
from ddtrace.llmobs import LLMObs
6265

66+
init_api()
67+
llmobs_api_key = api._api_key
68+
6369
logger = logging.getLogger(__name__)
6470

6571
DD_FLUSH_TO_LOG = "DD_FLUSH_TO_LOG"
@@ -229,7 +235,10 @@ def __init__(self, func):
229235

230236
# Enable LLM Observability
231237
if llmobs_env_var:
232-
LLMObs.enable()
238+
LLMObs.enable(
239+
agentless_enabled=True,
240+
api_key=llmobs_api_key,
241+
)
233242

234243
logger.debug("datadog_lambda_wrapper initialized")
235244
except Exception as e:

0 commit comments

Comments
 (0)