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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
wip redundant code
Ryan Crabbee988867480a5
diff --git a/litellm/proxy/proxy_cli.py b/litellm/proxy/proxy_cli.pyindex 1be4931aeef..480f00c3562 100644--- a/litellm/proxy/proxy_cli.py+++ b/litellm/proxy/proxy_cli.py@@ -322,9 +322,6 @@ class ProxyInitializationHelpers:"""Auto-create PROMETHEUS_MULTIPROC_DIR when running with multiple workersand prometheus is configured as a callback.-- If the env var is already set by the user, just ensure the directory exists.- Otherwise, create a temp directory and set the env var."""import tempfile@@ -341,25 +338,25 @@ class ProxyInitializationHelpers:from litellm.proxy.prometheus_cleanup import wipe_directory- existing_dir = os.environ.get(- "PROMETHEUS_MULTIPROC_DIR"- ) or os.environ.get("prometheus_multiproc_dir")- if existing_dir:- os.makedirs(existing_dir, exist_ok=True)- wipe_directory(existing_dir)- print( # noqa- f"LiteLLM: Using existing PROMETHEUS_MULTIPROC_DIR={existing_dir}"- )- return+ multiproc_dir = (+ os.environ.get("PROMETHEUS_MULTIPROC_DIR")+ or os.environ.get("prometheus_multiproc_dir")+ )+ auto_created = not multiproc_dir++ if not multiproc_dir:+ multiproc_dir = os.path.join(+ tempfile.gettempdir(), "litellm_prometheus_multiproc"+ )multiproc_dir = os.path.join(tempfile.gettempdir(), "litellm_prometheus_multiproc")os.makedirs(multiproc_dir, exist_ok=True)wipe_directory(multiproc_dir)- os.environ["PROMETHEUS_MULTIPROC_DIR"] = multiproc_dir+ action = "Auto-created" if auto_created else "Use existing"print( # noqa- f"LiteLLM: Auto-created PROMETHEUS_MULTIPROC_DIR={multiproc_dir}"+ f"LiteLLM {action}: Auto-created PROMETHEUS_MULTIPROC_DIR={multiproc_dir}")diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex c24942e1356..9802d8df6c9 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -2062,10 +2062,6 @@ def _schedule_background_health_check_db_save(async def _periodic_prometheus_cleanup():"""Periodically mark dead worker PIDs in the prometheus multiproc directory.-- Uses mark_process_dead() which only removes gauge_live* files, preserving- counter/histogram data for correct aggregation. First run is 1 hour after- startup (startup wipe handles stale files), then every hour thereafter."""from litellm.proxy.prometheus_cleanup import mark_dead_pids