Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

(Fix + Testing) - Add `dd-trace-run` to litellm ci/cd pipeline + fix bug caused by `dd-trace` patching OpenAI sdk (#7820)

Ishaan Jaff9b944ca60c3a
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 1a3dab8a996..34f4588ddb6 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1120,6 +1120,9 @@ jobs:
-e AWS_REGION_NAME=$AWS_REGION_NAME \
-e AUTO_INFER_REGION=True \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
+ -e USE_DDTRACE=True \
+ -e DD_API_KEY=$DD_API_KEY \
+ -e DD_SITE=$DD_SITE \
-e LITELLM_LICENSE=$LITELLM_LICENSE \
-e LANGFUSE_PROJECT1_PUBLIC=$LANGFUSE_PROJECT1_PUBLIC \
-e LANGFUSE_PROJECT2_PUBLIC=$LANGFUSE_PROJECT2_PUBLIC \
@@ -1239,6 +1242,9 @@ jobs:
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
-e AWS_REGION_NAME=$AWS_REGION_NAME \
-e AUTO_INFER_REGION=True \
+ -e USE_DDTRACE=True \
+ -e DD_API_KEY=$DD_API_KEY \
+ -e DD_SITE=$DD_SITE \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
-e LITELLM_LICENSE=$LITELLM_LICENSE \
-e LANGFUSE_PROJECT1_PUBLIC=$LANGFUSE_PROJECT1_PUBLIC \
@@ -1355,6 +1361,9 @@ jobs:
-e APORIA_API_BASE_1=$APORIA_API_BASE_1 \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
+ -e USE_DDTRACE=True \
+ -e DD_API_KEY=$DD_API_KEY \
+ -e DD_SITE=$DD_SITE \
-e AWS_REGION_NAME=$AWS_REGION_NAME \
-e APORIA_API_KEY_1=$APORIA_API_KEY_1 \
-e COHERE_API_KEY=$COHERE_API_KEY \
@@ -1436,26 +1445,23 @@ jobs:
- store_test_results:
path: test-results
proxy_build_from_pip_tests:
+ # Change from docker to machine executor
machine:
image: ubuntu-2204:2023.10.1
resource_class: xlarge
working_directory: ~/project
steps:
- checkout
+ # Remove Docker CLI installation since it's already available in machine executor
- run:
- name: Install Docker CLI (In case it's not already installed)
- command: |
- sudo apt-get update
- sudo apt-get install -y docker-ce docker-ce-cli containerd.io
- - run:
- name: Install Python 3.9
+ name: Install Python 3.13
command: |
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh --output miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
conda init bash
source ~/.bashrc
- conda create -n myenv python=3.9 -y
+ conda create -n myenv python=3.13 -y
conda activate myenv
python --version
- run:
@@ -1499,6 +1505,9 @@ jobs:
-e AWS_REGION_NAME=$AWS_REGION_NAME \
-e APORIA_API_KEY_1=$APORIA_API_KEY_1 \
-e COHERE_API_KEY=$COHERE_API_KEY \
+ -e USE_DDTRACE=True \
+ -e DD_API_KEY=$DD_API_KEY \
+ -e DD_SITE=$DD_SITE \
-e GCS_FLUSH_INTERVAL="1" \
--name my-app \
-v $(pwd)/litellm_config.yaml:/app/config.yaml \
@@ -1597,6 +1606,9 @@ jobs:
-e OPENAI_API_KEY=$OPENAI_API_KEY \
-e GEMINI_API_KEY=$GEMINI_API_KEY \
-e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
+ -e USE_DDTRACE=True \
+ -e DD_API_KEY=$DD_API_KEY \
+ -e DD_SITE=$DD_SITE \
-e LITELLM_LICENSE=$LITELLM_LICENSE \
--name my-app \
-v $(pwd)/litellm/proxy/example_config_yaml/pass_through_config.yaml:/app/config.yaml \
diff --git a/docker/build_from_pip/requirements.txt b/docker/build_from_pip/requirements.txt
index fb2d6b697db..3fa275ac082 100644
--- a/docker/build_from_pip/requirements.txt
+++ b/docker/build_from_pip/requirements.txt
@@ -1,4 +1,5 @@
-litellm[proxy]==1.57.3 # Specify the litellm version you want to use
+litellm[proxy] # Specify the litellm version you want to use
prometheus_client
langfuse
-prisma
\ No newline at end of file
+prisma
+ddtrace==2.19.0 # for advanced DD tracing / profiling
diff --git a/docker/prod_entrypoint.sh b/docker/prod_entrypoint.sh
index 077aa11ea2d..ea94c343801 100644
--- a/docker/prod_entrypoint.sh
+++ b/docker/prod_entrypoint.sh
@@ -1,6 +1,7 @@
#!/bin/sh
if [ "$USE_DDTRACE" = "true" ]; then
+ export DD_TRACE_OPENAI_ENABLED="False"
exec ddtrace-run litellm "$@"
else
exec litellm "$@"
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py
index c40bdb2b2e6..082e5251f03 100644
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@ -3251,7 +3251,7 @@ class ProxyStartupEvent:
if get_secret_bool("USE_DDTRACE", False) is True:
import ddtrace
- ddtrace.patch_all(logging=True)
+ ddtrace.patch_all(logging=True, openai=False)
#### API ENDPOINTS ####
diff --git a/requirements.txt b/requirements.txt
index bccbc0ea1cd..df314bd9519 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -20,7 +20,7 @@ google-generativeai==0.5.0 # for vertex ai calls
async_generator==1.10.0 # for async ollama calls
langfuse==2.45.0 # for langfuse self-hosted logging
prometheus_client==0.20.0 # for /metrics endpoint on proxy
-ddtrace==2.19.0rc1 # for advanced DD tracing / profiling
+ddtrace==2.19.0 # for advanced DD tracing / profiling
orjson==3.10.12 # fast /embedding responses
apscheduler==3.10.4 # for resetting budget in background
fastapi-sso==0.16.0 # admin UI, SSO