From 413877d1c6427a9e9c7e4badc146b978337f92d8 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 27 Jun 2024 21:03:36 -0700 Subject: [PATCH] fix pre call utils adding extra headers --- litellm/proxy/litellm_pre_call_utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/litellm/proxy/litellm_pre_call_utils.py b/litellm/proxy/litellm_pre_call_utils.py index 963cdf027c1..673b027ca8c 100644 --- a/litellm/proxy/litellm_pre_call_utils.py +++ b/litellm/proxy/litellm_pre_call_utils.py @@ -175,8 +175,14 @@ async def add_litellm_data_to_request( def _add_otel_traceparent_to_data(data: dict, request: Request): + from litellm.proxy.proxy_server import open_telemetry_logger + if data is None: return + if open_telemetry_logger is None: + # if user is not use OTEL don't send extra_headers + # relevant issue: https://github.com/BerriAI/litellm/issues/4448 + return if request.headers: if "traceparent" in request.headers: # we want to forward this to the LLM Provider