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(prometheus.py): always initialize label_filters for PrometheusLogger (#11764)

Cole McIntosh6d373876d227
diff --git a/litellm/integrations/prometheus.py b/litellm/integrations/prometheus.py
index e360e26ab55..42d14eeb937 100644
--- a/litellm/integrations/prometheus.py
+++ b/litellm/integrations/prometheus.py
@@ -41,6 +41,9 @@ class PrometheusLogger(CustomLogger):
from litellm.proxy.proxy_server import CommonProxyErrors, premium_user
+ # Always initialize label_filters, even for non-premium users
+ self.label_filters = self._parse_prometheus_config()
+
if premium_user is not True:
verbose_logger.warning(
f"🚨🚨🚨 Prometheus Metrics is on LiteLLM Enterprise\n🚨 {CommonProxyErrors.not_premium_user.value}"
@@ -51,9 +54,6 @@ class PrometheusLogger(CustomLogger):
)
return
- # Parse prometheus metrics configuration for label filtering
- self.label_filters = self._parse_prometheus_config()
-
# Create metric factory functions
self._counter_factory = self._create_metric_factory(Counter)
self._gauge_factory = self._create_metric_factory(Gauge)