Skip to content

[MLOB] revert forced agentless and api key fetching #585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions datadog_lambda/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,10 @@
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 get_api_key
from ddtrace.llmobs import LLMObs

llmobs_api_key = get_api_key()

logger = logging.getLogger(__name__)

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

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

Choose a reason for hiding this comment

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

Would it be worth it to consolidate these two if llmobs_env_var blocks into a single location?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i think we need to have them separate because we use LLMObs in two different scopes. if we imported and enabled in the same block, then we wouldn't be able to use it in the flush block without importing it again. i think it's OK to leave as-is for now

Copy link
Contributor

Choose a reason for hiding this comment

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

ahhh, great point! you're totally right.


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