Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion datadog_lambda/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,16 @@
if profiling_env_var:
from ddtrace.profiling import profiler

llmobs_api_key = None
llmobs_env_var = os.environ.get("DD_LLMOBS_ENABLED", "false").lower() in ("true", "1")
if llmobs_env_var:
from datadog_lambda.api import init_api
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice use of lazy loading here!

from datadog import api
from ddtrace.llmobs import LLMObs

init_api()
llmobs_api_key = api._api_key

logger = logging.getLogger(__name__)

DD_FLUSH_TO_LOG = "DD_FLUSH_TO_LOG"
Expand Down Expand Up @@ -229,7 +235,10 @@ def __init__(self, func):

# Enable LLM Observability
if llmobs_env_var:
LLMObs.enable()
LLMObs.enable(
agentless_enabled=True,
api_key=llmobs_api_key,
)

logger.debug("datadog_lambda_wrapper initialized")
except Exception as e:
Expand Down
Loading