Skip to content

Commit d89952e

Browse files
chore(llmobs): add url origin env var [backport 3.12] (#14318)
Backport 2a2cc12 from #14315 to 3.12. Enable users to override the origin of the url to allow users to send the data to a different local endpoint than APM. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) Co-authored-by: kyle <[email protected]>
1 parent b3079f2 commit d89952e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ddtrace/llmobs/_writer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import atexit
22
import json
3+
import os
34
from typing import Any
45
from typing import Dict
56
from typing import List
@@ -146,10 +147,10 @@ def __init__(
146147
self._api_key: str = _api_key or config._dd_api_key
147148
self._site: str = _site or config._dd_site
148149
self._app_key: str = _app_key
149-
self._override_url: str = _override_url
150+
self._override_url: str = _override_url or os.environ.get("DD_LLMOBS_OVERRIDE_ORIGIN", "")
150151

151152
self._agentless: bool = is_agentless
152-
self._intake: str = _override_url or (
153+
self._intake: str = self._override_url or (
153154
f"{self.AGENTLESS_BASE_URL}.{self._site}" if is_agentless else agent_config.trace_agent_url
154155
)
155156
self._endpoint: str = self.ENDPOINT if is_agentless else f"{EVP_PROXY_AGENT_BASE_PATH}{self.ENDPOINT}"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
other:
3+
- |
4+
LLM Observability: add ability to override the URL origin.

0 commit comments

Comments
 (0)