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]

allow setting PROMETHEUS_SELECTED_INSTANCE

Ishaan Jaffdd9be6f160cf
diff --git a/litellm/integrations/prometheus_helpers/prometheus_api.py b/litellm/integrations/prometheus_helpers/prometheus_api.py
index 247171e579a..86764df7dd3 100644
--- a/litellm/integrations/prometheus_helpers/prometheus_api.py
+++ b/litellm/integrations/prometheus_helpers/prometheus_api.py
@@ -57,6 +57,10 @@ async def get_fallback_metric_from_prometheus():
metric_values = result["values"]
most_recent_value = metric_values[0]
+ if PROMETHEUS_SELECTED_INSTANCE is not None:
+ if metric.get("instance") != PROMETHEUS_SELECTED_INSTANCE:
+ continue
+
value = int(float(most_recent_value[1])) # Convert value to integer
primary_model = metric.get("primary_model", "Unknown")
fallback_model = metric.get("fallback_model", "Unknown")